diff -Nrcpad gcc-4.5.0/gcc/fortran/ChangeLog gcc-4.5.1/gcc/fortran/ChangeLog *** gcc-4.5.0/gcc/fortran/ChangeLog Wed Apr 14 09:22:16 2010 --- gcc-4.5.1/gcc/fortran/ChangeLog Sat Jul 31 09:26:21 2010 *************** *** 1,3 **** --- 1,223 ---- + 2010-07-31 Release Manager + + * GCC 4.5.1 released. + + 2010-07-21 Steven G. Kargl + + PR fortran/44929 + * Revert my commit r162326 for this PR. + + 2010-07-19 Steven G. Kargl + + PR fortran/44929 + * fortran/match.c (match_type_spec): Check for derived type before + intrinsic types. + + 2010-07-18 Daniel Franke + Paul Thomas + + PR fortran/30668 + PR fortran/31346 + PR fortran/34260 + * resolve.c (resolve_global_procedure): Improved checking if an + explicit interface is required. + + PR fortran/40011 + * resolve.c (resolve_global_procedure): Resolve the gsymbol's + namespace before trying to reorder the gsymbols. + + 2010-07-11 Paul Thomas + + PR fortran/44773 + * trans-expr.c (arrayfunc_assign_needs_temporary): No temporary + if the lhs has never been host associated, as well as not being + use associated, a pointer or a target. + * resolve.c (resolve_variable): Mark variables that are host + associated. + * gfortran.h: Add the host_assoc bit to the symbol_attribute + structure. + + 2010-07-08 Jakub Jelinek + + PR fortran/44847 + * match.c (match_exit_cycle): Error on EXIT also from collapsed + !$omp do loops. Error on CYCLE to non-innermost collapsed + !$omp do loops. + + 2010-06-29 Paul Thomas + + PR fortran/44582 + * trans-expr.c (arrayfunc_assign_needs_temporary): New function + to determine if a function assignment can be made without a + temporary. + (gfc_trans_arrayfunc_assign): Move all the conditions that + suppress the direct function call to the above new functon and + call it. + + 2010-06-27 Paul Thomas + + PR fortran/43841 + PR fortran/43843 + * trans-expr.c (gfc_conv_expr): Supply an address expression for + GFC_SS_REFERENCE. + (gfc_conv_expr_reference): Call gfc_conv_expr and return for + GFC_SS_REFERENCE. + * trans-array.c (gfc_add_loop_ss_code): Store the value rather + than the address of a GFC_SS_REFERENCE. + * trans.h : Change comment on GFC_SS_REFERENCE. + + 2010-06-22 Tobias Burnus + + PR fortran/44556 + * resolve.c (resolve_allocate_deallocate): Properly check + part-refs in stat=/errmsg= for invalid use. + + 2010-06-15 Tobias Burnus + + * gfc-internals.texi (copyrights-gfortran): Fix copyright year format. + * gfortran.texi (copyrights-gfortran): Ditto. + + 2010-06-15 Jakub Jelinek + + PR fortran/44536 + * trans-openmp.c (gfc_omp_predetermined_sharing): Don't return + OMP_CLAUSE_DEFAULT_SHARED for artificial vars with + GFC_DECL_SAVED_DESCRIPTOR set. + (gfc_omp_report_decl): New function. + * trans.h (gfc_omp_report_decl): New prototype. + * f95-lang.c (LANG_HOOKS_OMP_REPORT_DECL): Redefine. + + 2010-06-12 Daniel Franke + + PR fortran/44347 + * check.c (gfc_check_selected_real_kind): Verify that the + actual arguments are scalar. + + 2010-06-12 Janus Weil + + PR fortran/44430 + * dump-parse-tree.c (show_symbol): Avoid infinite loop. + + 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. + + 2010-06-02 Tobias Burnus + + PR fortran/44360 + * parse.c (gfc_fixup_sibling_symbols): Do not "fix" use-associated + symbols. + + 2010-05-19 Tobias Burnus + + PR fortran/43591 + * expr.c (gfc_is_constant_expr, gfc_traverse_expr): Handle + proc-pointers and type-bound procedures. + (gfc_specification_expr): Check proc-pointers for pureness. + + 2010-05-14 Steven G. Kargl + + PR fortran/44135 + * fortran/interface.c (get_sym_storage_size): Use signed instead of + unsigned mpz_get_?i routines. + + 2010-05-13 Jakub Jelinek + + PR fortran/44036 + * openmp.c (resolve_omp_clauses): Allow procedure pointers in clause + variable lists. + * trans-openmp.c (gfc_omp_privatize_by_reference): Don't privatize + by reference dummy procedures or non-dummy procedure pointers. + (gfc_omp_predetermined_sharing): Return + OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for dummy procedures. + + 2010-05-12 Daniel Franke + + PR fortran/40728 + * intrinc.c (gfc_is_intrinsic): Do not prematurely mark symbol + as external. + + 2010-05-06 Tobias Burnus + + PR fortran/43985 + * trans-types.c (gfc_sym_type): Mark Cray pointees as + GFC_POINTER_TYPE_P. + + 2010-05-05 Steven G. Kargl + + PR fortran/43592 + * fortran/parse.c (parse_interface): Do not dereference a NULL pointer. + + 2010-04-25 Janne Blomqvist + + PR fortran/40539 + * gcc/fortran/gfortran.texi: Add section about representation of + LOGICAL variables. + + 2010-04-24 Steven G. Kargl + + PR fortran/30073 + PR fortran/43793 + * trans-array.c (gfc_trans_array_bound_check): Use TREE_CODE instead + of mucking with a tree directly. + + 2010-04-24 Paul Thomas + + PR fortran/43227 + * resolve.c (resolve_fl_derived): If a component character + length has not been resolved, do so now. + (resolve_symbol): The same as above for a symbol character + length. + * trans-decl.c (gfc_create_module_variable): A 'length' decl is + not needed for a character valued, procedure pointer. + + PR fortran/43266 + * resolve.c (ensure_not_abstract_walker): If 'overriding' is + not found, return FAILURE rather than ICEing. + + 2010-04-21 Jakub Jelinek + + PR fortran/43836 + * f95-lang.c (gfc_define_builtin): Set TREE_NOTHROW on + the decl. + + 2010-04-20 Harald Anlauf + + * intrinsic.c (sort_actual): Remove 'is' in error message. + + 2010-04-20 Jakub Jelinek + + PR fortran/43339 + * openmp.c (gfc_resolve_do_iterator): Only make iteration vars for + sequential loops private in the innermost containing task region. + + 2010-04-17 Steven G. Kargl + + PR fortran/31538 + * fortran/trans-array.c (gfc_conv_ss_startstride): Remove the use of + gfc_msg_bounds by using 'Array bound mismatch' directly. + (gfc_trans_dummy_array_bias): Remove the use of gfc_msg_bounds. Reword + error message to include the mismatch in the extent of array bound. + * fortran/trans.c: Remove gfc_msg_bounds. It is only used in one place. + * fortran/trans.h: Remove extern definition of gfc_msg_bounds. + + 2010-04-16 Steven G. Kargl + + PR fortran/30073 + * trans-array.c (gfc_trans_array_bound_check): Eliminate a redundant + block of code. Set name to the variable associated with the descriptor. + 2010-04-14 Release Manager * GCC 4.5.0 released. diff -Nrcpad gcc-4.5.0/gcc/fortran/check.c gcc-4.5.1/gcc/fortran/check.c *** gcc-4.5.0/gcc/fortran/check.c Thu Oct 29 15:24:38 2009 --- gcc-4.5.1/gcc/fortran/check.c Sat Jun 12 11:21:17 2010 *************** array_check (gfc_expr *e, int n) *** 214,219 **** --- 214,293 ---- } + /* If expr is a constant, then check to ensure that it is greater than + of equal to zero. */ + + static gfc_try + nonnegative_check (const char *arg, gfc_expr *expr) + { + int i; + + if (expr->expr_type == EXPR_CONSTANT) + { + gfc_extract_int (expr, &i); + if (i < 0) + { + gfc_error ("'%s' at %L must be nonnegative", arg, &expr->where); + return FAILURE; + } + } + + return SUCCESS; + } + + + /* If expr2 is constant, then check that the value is less than + bit_size(expr1). */ + + static gfc_try + less_than_bitsize1 (const char *arg1, gfc_expr *expr1, const char *arg2, + gfc_expr *expr2) + { + int i2, i3; + + if (expr2->expr_type == EXPR_CONSTANT) + { + gfc_extract_int (expr2, &i2); + i3 = gfc_validate_kind (BT_INTEGER, expr1->ts.kind, false); + if (i2 >= gfc_integer_kinds[i3].bit_size) + { + gfc_error ("'%s' at %L must be less than BIT_SIZE('%s')", + arg2, &expr2->where, arg1); + return FAILURE; + } + } + + return SUCCESS; + } + + + /* If expr2 and expr3 are constants, then check that the value is less than + or equal to bit_size(expr1). */ + + static gfc_try + less_than_bitsize2 (const char *arg1, gfc_expr *expr1, const char *arg2, + gfc_expr *expr2, const char *arg3, gfc_expr *expr3) + { + int i2, i3; + + if (expr2->expr_type == EXPR_CONSTANT && expr3->expr_type == EXPR_CONSTANT) + { + gfc_extract_int (expr2, &i2); + gfc_extract_int (expr3, &i3); + i2 += i3; + i3 = gfc_validate_kind (BT_INTEGER, expr1->ts.kind, false); + if (i2 > gfc_integer_kinds[i3].bit_size) + { + gfc_error ("'%s + %s' at %L must be less than or equal " + "to BIT_SIZE('%s')", + arg2, arg3, &expr2->where, arg1); + return FAILURE; + } + } + + return SUCCESS; + } + /* Make sure two expressions have the same type. */ static gfc_try *************** gfc_check_besn (gfc_expr *n, gfc_expr *x *** 709,721 **** gfc_try ! gfc_check_btest (gfc_expr *i, gfc_expr *pos) { if (type_check (i, 0, BT_INTEGER) == FAILURE) return FAILURE; if (type_check (pos, 1, BT_INTEGER) == FAILURE) return FAILURE; return SUCCESS; } --- 783,802 ---- gfc_try ! gfc_check_bitfcn (gfc_expr *i, gfc_expr *pos) { if (type_check (i, 0, BT_INTEGER) == FAILURE) return FAILURE; + if (type_check (pos, 1, BT_INTEGER) == FAILURE) return FAILURE; + if (nonnegative_check ("pos", pos) == FAILURE) + return FAILURE; + + if (less_than_bitsize1 ("i", i, "pos", pos) == FAILURE) + return FAILURE; + return SUCCESS; } *************** gfc_check_iand (gfc_expr *i, gfc_expr *j *** 1319,1337 **** gfc_try - gfc_check_ibclr (gfc_expr *i, gfc_expr *pos) - { - if (type_check (i, 0, BT_INTEGER) == FAILURE) - return FAILURE; - - if (type_check (pos, 1, BT_INTEGER) == FAILURE) - return FAILURE; - - return SUCCESS; - } - - - gfc_try gfc_check_ibits (gfc_expr *i, gfc_expr *pos, gfc_expr *len) { if (type_check (i, 0, BT_INTEGER) == FAILURE) --- 1400,1405 ---- *************** gfc_check_ibits (gfc_expr *i, gfc_expr * *** 1343,1359 **** if (type_check (len, 2, BT_INTEGER) == FAILURE) return FAILURE; ! return SUCCESS; ! } ! ! gfc_try ! gfc_check_ibset (gfc_expr *i, gfc_expr *pos) ! { ! if (type_check (i, 0, BT_INTEGER) == FAILURE) return FAILURE; ! if (type_check (pos, 1, BT_INTEGER) == FAILURE) return FAILURE; return SUCCESS; --- 1411,1423 ---- if (type_check (len, 2, BT_INTEGER) == FAILURE) return FAILURE; ! if (nonnegative_check ("pos", pos) == FAILURE) ! return FAILURE; ! if (nonnegative_check ("len", len) == FAILURE) return FAILURE; ! if (less_than_bitsize2 ("i", i, "pos", pos, "len", len) == FAILURE) return FAILURE; return SUCCESS; *************** gfc_check_selected_real_kind (gfc_expr * *** 2771,2781 **** return FAILURE; } ! if (p != NULL && type_check (p, 0, BT_INTEGER) == FAILURE) ! return FAILURE; ! if (r != NULL && type_check (r, 1, BT_INTEGER) == FAILURE) ! return FAILURE; return SUCCESS; } --- 2835,2857 ---- return FAILURE; } ! if (p) ! { ! if (type_check (p, 0, BT_INTEGER) == FAILURE) ! return FAILURE; ! if (scalar_check (p, 0) == FAILURE) ! return FAILURE; ! } ! ! if (r) ! { ! if (type_check (r, 1, BT_INTEGER) == FAILURE) ! return FAILURE; ! ! if (scalar_check (r, 1) == FAILURE) ! return FAILURE; ! } return SUCCESS; } *************** gfc_check_mvbits (gfc_expr *from, gfc_ex *** 3438,3443 **** --- 3514,3535 ---- if (type_check (topos, 4, BT_INTEGER) == FAILURE) return FAILURE; + if (nonnegative_check ("frompos", frompos) == FAILURE) + return FAILURE; + + if (nonnegative_check ("topos", topos) == FAILURE) + return FAILURE; + + if (nonnegative_check ("len", len) == FAILURE) + return FAILURE; + + if (less_than_bitsize2 ("from", from, "frompos", frompos, "len", len) + == FAILURE) + return FAILURE; + + if (less_than_bitsize2 ("to", to, "topos", topos, "len", len) == FAILURE) + return FAILURE; + return SUCCESS; } diff -Nrcpad gcc-4.5.0/gcc/fortran/dump-parse-tree.c gcc-4.5.1/gcc/fortran/dump-parse-tree.c *** gcc-4.5.0/gcc/fortran/dump-parse-tree.c Fri Jan 8 09:23:26 2010 --- gcc-4.5.1/gcc/fortran/dump-parse-tree.c Sat Jun 12 04:02:27 2010 *************** show_symbol (gfc_symbol *sym) *** 848,854 **** } } ! if (sym->formal_ns) { show_indent (); fputs ("Formal namespace", dumpfile); --- 848,854 ---- } } ! if (sym->formal_ns && (sym->formal_ns->proc_name != sym)) { show_indent (); fputs ("Formal namespace", dumpfile); diff -Nrcpad gcc-4.5.0/gcc/fortran/expr.c gcc-4.5.1/gcc/fortran/expr.c *** gcc-4.5.0/gcc/fortran/expr.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/expr.c Wed May 19 07:22:00 2010 *************** gfc_is_constant_expr (gfc_expr *e) *** 782,787 **** --- 782,789 ---- break; case EXPR_FUNCTION: + case EXPR_PPC: + case EXPR_COMPCALL: /* Specification functions are constant. */ if (check_specification_function (e) == MATCH_YES) { *************** check_restricted (gfc_expr *e) *** 2808,2813 **** --- 2810,2816 ---- gfc_try gfc_specification_expr (gfc_expr *e) { + gfc_component *comp; if (e == NULL) return SUCCESS; *************** gfc_specification_expr (gfc_expr *e) *** 2822,2828 **** if (e->expr_type == EXPR_FUNCTION && !e->value.function.isym && !e->value.function.esym ! && !gfc_pure (e->symtree->n.sym)) { gfc_error ("Function '%s' at %L must be PURE", e->symtree->n.sym->name, &e->where); --- 2825,2833 ---- if (e->expr_type == EXPR_FUNCTION && !e->value.function.isym && !e->value.function.esym ! && !gfc_pure (e->symtree->n.sym) ! && (!gfc_is_proc_ptr_comp (e, &comp) ! || !comp-> attr.pure)) { gfc_error ("Function '%s' at %L must be PURE", e->symtree->n.sym->name, &e->where); *************** gfc_traverse_expr (gfc_expr *expr, gfc_s *** 3560,3565 **** --- 3565,3572 ---- switch (expr->expr_type) { + case EXPR_PPC: + case EXPR_COMPCALL: case EXPR_FUNCTION: for (args = expr->value.function.actual; args; args = args->next) { diff -Nrcpad gcc-4.5.0/gcc/fortran/f95-lang.c gcc-4.5.1/gcc/fortran/f95-lang.c *** gcc-4.5.0/gcc/fortran/f95-lang.c Mon Sep 28 16:44:32 2009 --- gcc-4.5.1/gcc/fortran/f95-lang.c Tue Jun 15 12:17:16 2010 *************** *** 1,5 **** /* gfortran backend interface ! Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Paul Brook. --- 1,5 ---- /* gfortran backend interface ! Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. Contributed by Paul Brook. *************** static void gfc_init_ts (void); *** 116,121 **** --- 116,122 ---- #undef LANG_HOOKS_INIT_TS #undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING + #undef LANG_HOOKS_OMP_REPORT_DECL #undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR #undef LANG_HOOKS_OMP_CLAUSE_COPY_CTOR #undef LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP *************** static void gfc_init_ts (void); *** 142,147 **** --- 143,149 ---- #define LANG_HOOKS_INIT_TS gfc_init_ts #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE gfc_omp_privatize_by_reference #define LANG_HOOKS_OMP_PREDETERMINED_SHARING gfc_omp_predetermined_sharing + #define LANG_HOOKS_OMP_REPORT_DECL gfc_omp_report_decl #define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR gfc_omp_clause_default_ctor #define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR gfc_omp_clause_copy_ctor #define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP gfc_omp_clause_assign_op *************** gfc_define_builtin (const char *name, *** 608,613 **** --- 610,616 ---- library_name, NULL_TREE); if (const_p) TREE_READONLY (decl) = 1; + TREE_NOTHROW (decl) = 1; built_in_decls[code] = decl; implicit_built_in_decls[code] = decl; diff -Nrcpad gcc-4.5.0/gcc/fortran/gfc-internals.texi gcc-4.5.1/gcc/fortran/gfc-internals.texi *** gcc-4.5.0/gcc/fortran/gfc-internals.texi Wed Dec 16 00:54:44 2009 --- gcc-4.5.1/gcc/fortran/gfc-internals.texi Tue Jun 15 16:30:58 2010 *************** *** 1,7 **** \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename gfc-internals.info ! @set copyrights-gfortran 2007-2008 @include gcc-common.texi --- 1,7 ---- \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename gfc-internals.info ! @set copyrights-gfortran 2007, 2008, 2009 @include gcc-common.texi diff -Nrcpad gcc-4.5.0/gcc/fortran/gfortran.h gcc-4.5.1/gcc/fortran/gfortran.h *** gcc-4.5.0/gcc/fortran/gfortran.h Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/gfortran.h Sun Jul 11 16:06:53 2010 *************** typedef struct *** 667,673 **** use_assoc:1, /* Symbol has been use-associated. */ use_only:1, /* Symbol has been use-associated, with ONLY. */ use_rename:1, /* Symbol has been use-associated and renamed. */ ! imported:1; /* Symbol has been associated by IMPORT. */ unsigned in_namelist:1, in_common:1, in_equivalence:1; unsigned function:1, subroutine:1, procedure:1; --- 667,674 ---- use_assoc:1, /* Symbol has been use-associated. */ use_only:1, /* Symbol has been use-associated, with ONLY. */ use_rename:1, /* Symbol has been use-associated and renamed. */ ! imported:1, /* Symbol has been associated by IMPORT. */ ! host_assoc:1; /* Symbol has been host associated. */ unsigned in_namelist:1, in_common:1, in_equivalence:1; unsigned function:1, subroutine:1, procedure:1; diff -Nrcpad gcc-4.5.0/gcc/fortran/gfortran.info gcc-4.5.1/gcc/fortran/gfortran.info *** gcc-4.5.0/gcc/fortran/gfortran.info Wed Apr 14 10:10:30 2010 --- gcc-4.5.1/gcc/fortran/gfortran.info Sat Jul 31 10:15:27 2010 *************** *** 1,7 **** This is doc/gfortran.info, produced by makeinfo version 4.12 from ! /space/rguenther/gcc-4.5.0/gcc-4.5.0/gcc/fortran/gfortran.texi. ! Copyright (C) 1999-2008 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or --- 1,8 ---- This is doc/gfortran.info, produced by makeinfo version 4.12 from ! /space/rguenther/gcc-4.5.1/gcc-4.5.1/gcc/fortran/gfortran.texi. ! Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, ! 2008, 2009, 2010 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or *************** compiler, (`gfortran'). *** 31,37 **** Published by the Free Software Foundation 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA ! Copyright (C) 1999-2008 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or --- 32,39 ---- Published by the Free Software Foundation 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA ! Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, ! 2008, 2009, 2010 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or *************** Part I: Invoking GNU Fortran *** 71,77 **** Part II: Language Reference * Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. ! * Compiler Characteristics:: KIND type parameters supported. * Mixed-Language Programming:: Interoperability with C * Extensions:: Language extensions implemented by GNU Fortran. * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran. --- 73,79 ---- Part II: Language Reference * Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. ! * Compiler Characteristics:: User-visible implementation details. * Mixed-Language Programming:: Interoperability with C * Extensions:: Language extensions implemented by GNU Fortran. * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran. *************** File: gfortran.info, Node: Compiler Cha *** 1863,1876 **** ************************** This chapter describes certain characteristics of the GNU Fortran ! compiler, namely the KIND type parameter values supported. * Menu: * KIND Type Parameters::  ! File: gfortran.info, Node: KIND Type Parameters, Up: Compiler Characteristics 5.1 KIND Type Parameters ======================== --- 1865,1880 ---- ************************** This chapter describes certain characteristics of the GNU Fortran ! compiler, that are not specified by the Fortran standard, but which ! might in some way or another become visible to the programmer. * Menu: * KIND Type Parameters:: + * Internal representation of LOGICAL variables::  ! File: gfortran.info, Node: KIND Type Parameters, Next: Internal representation of LOGICAL variables, Up: Compiler Characteristics 5.1 KIND Type Parameters ======================== *************** imaginary part are a real value of the g *** 1906,1911 **** --- 1910,1941 ---- to use the `SELECT_*_KIND' intrinsics instead of the concrete values.  + File: gfortran.info, Node: Internal representation of LOGICAL variables, Prev: KIND Type Parameters, Up: Compiler Characteristics + + 5.2 Internal representation of LOGICAL variables + ================================================ + + The Fortran standard does not specify how variables of `LOGICAL' type + are represented, beyond requiring that `LOGICAL' variables of default + kind have the same storage size as default `INTEGER' and `REAL' + variables. The GNU Fortran internal representation is as follows. + + A `LOGICAL(KIND=N)' variable is represented as an `INTEGER(KIND=N)' + variable, however, with only two permissible values: `1' for `.TRUE.' + and `0' for `.FALSE.'. Any other integer value results in undefined + behavior. + + Note that for mixed-language programming using the `ISO_C_BINDING' + feature, there is a `C_BOOL' kind that can be used to create + `LOGICAL(KIND=C_BOOL)' variables which are interoperable with the C99 + _Bool type. The C99 _Bool type has an internal representation + described in the C99 standard, which is identical to the above + description, i.e. with 1 for true and 0 for false being the only + permissible values. Thus the internal representation of `LOGICAL' + variables in GNU Fortran is identical to C99 _Bool, except for a + possible difference in storage size depending on the kind. + +  File: gfortran.info, Node: Extensions, Next: Intrinsic Procedures, Prev: Mixed-Language Programming, Up: Top 6 Extensions *************** Keyword Index *** 15146,15151 **** --- 15176,15183 ---- * logical not, bitwise: NOT. (line 6) * logical or, bitwise <1>: OR. (line 6) * logical or, bitwise: IOR. (line 6) + * logical, variable representation: Internal representation of LOGICAL variables. + (line 6) * login name: GETLOG. (line 6) * LONG: LONG. (line 6) * LSHIFT: LSHIFT. (line 6) *************** Keyword Index *** 15555,15876 ****  Tag Table: ! Node: Top2004 ! Node: Introduction3377 ! Node: About GNU Fortran4124 ! Node: GNU Fortran and GCC8111 ! Node: Preprocessing and conditional compilation10223 ! Node: GNU Fortran and G7711864 ! Node: Project Status12437 ! Node: Standards14969 ! Node: Varying Length Character Strings16365 ! Node: Invoking GNU Fortran16899 ! Node: Option Summary18622 ! Node: Fortran Dialect Options22251 ! Node: Preprocessing Options29289 ! Node: Error and Warning Options37415 ! Node: Debugging Options45049 ! Node: Directory Options47212 ! Node: Link Options48727 ! Node: Runtime Options49351 ! Node: Code Gen Options51600 ! Node: Environment Variables66360 ! Node: Runtime66965 ! Node: GFORTRAN_STDIN_UNIT68193 ! Node: GFORTRAN_STDOUT_UNIT68560 ! Node: GFORTRAN_STDERR_UNIT68961 ! Node: GFORTRAN_USE_STDERR69359 ! Node: GFORTRAN_TMPDIR69804 ! Node: GFORTRAN_UNBUFFERED_ALL70245 ! Node: GFORTRAN_UNBUFFERED_PRECONNECTED70768 ! Node: GFORTRAN_SHOW_LOCUS71410 ! Node: GFORTRAN_OPTIONAL_PLUS71904 ! Node: GFORTRAN_DEFAULT_RECL72379 ! Node: GFORTRAN_LIST_SEPARATOR72870 ! Node: GFORTRAN_CONVERT_UNIT73479 ! Node: GFORTRAN_ERROR_DUMPCORE76341 ! Node: GFORTRAN_ERROR_BACKTRACE76888 ! Node: Fortran 2003 and 2008 status77439 ! Node: Fortran 2003 status77679 ! Node: Fortran 2008 status80048 ! Node: Compiler Characteristics81149 ! Node: KIND Type Parameters81503 ! Node: Extensions82430 ! Node: Extensions implemented in GNU Fortran83031 ! Node: Old-style kind specifications84365 ! Node: Old-style variable initialization85471 ! Node: Extensions to namelist86783 ! Node: X format descriptor without count field88779 ! Node: Commas in FORMAT specifications89306 ! Node: Missing period in FORMAT specifications89823 ! Node: I/O item lists90385 ! Node: BOZ literal constants90774 ! Node: Real array indices93344 ! Node: Unary operators93641 ! Node: Implicitly convert LOGICAL and INTEGER values94055 ! Node: Hollerith constants support95015 ! Node: Cray pointers96787 ! Node: CONVERT specifier102197 ! Node: OpenMP104195 ! Node: Argument list functions106442 ! Node: Extensions not implemented in GNU Fortran108046 ! Node: STRUCTURE and RECORD108930 ! Node: ENCODE and DECODE statements110986 ! Node: Variable FORMAT expressions112344 ! Node: Mixed-Language Programming113401 ! Node: Interoperability with C113944 ! Node: Intrinsic Types115251 ! Node: Derived Types and struct115782 ! Node: Interoperable Global Variables117163 ! Node: Interoperable Subroutines and Functions118435 ! Node: Further Interoperability of Fortran with C122988 ! Node: GNU Fortran Compiler Directives123994 ! Node: Non-Fortran Main Program126191 ! Node: _gfortran_set_args128329 ! Node: _gfortran_set_options129263 ! Node: _gfortran_set_convert132099 ! Node: _gfortran_set_record_marker132963 ! Node: _gfortran_set_fpe133787 ! Node: _gfortran_set_max_subrecord_length134999 ! Node: Intrinsic Procedures135954 ! Node: Introduction to Intrinsics149644 ! Node: ABORT151996 ! Node: ABS152753 ! Node: ACCESS154255 ! Node: ACHAR156176 ! Node: ACOS157377 ! Node: ACOSH158499 ! Node: ADJUSTL159500 ! Node: ADJUSTR160441 ! Node: AIMAG161388 ! Node: AINT162708 ! Node: ALARM164180 ! Node: ALL165814 ! Node: ALLOCATED167732 ! Node: AND168613 ! Node: ANINT169910 ! Node: ANY171273 ! Node: ASIN173203 ! Node: ASINH174314 ! Node: ASSOCIATED175325 ! Node: ATAN178330 ! Node: ATAN2179629 ! Node: ATANH181150 ! Node: BESSEL_J0182159 ! Node: BESSEL_J1183203 ! Node: BESSEL_JN184255 ! Node: BESSEL_Y0185470 ! Node: BESSEL_Y1186470 ! Node: BESSEL_YN187470 ! Node: BIT_SIZE188687 ! Node: BTEST189516 ! Node: C_ASSOCIATED190404 ! Node: C_FUNLOC191613 ! Node: C_F_PROCPOINTER192982 ! Node: C_F_POINTER194483 ! Node: C_LOC195901 ! Node: C_SIZEOF197018 ! Node: CEILING198371 ! Node: CHAR199376 ! Node: CHDIR200440 ! Node: CHMOD201608 ! Node: CMPLX203403 ! Node: COMMAND_ARGUMENT_COUNT204867 ! Node: COMPLEX205783 ! Node: CONJG206926 ! Node: COS207936 ! Node: COSH209267 ! Node: COUNT210317 ! Node: CPU_TIME212333 ! Node: CSHIFT213687 ! Node: CTIME215343 ! Node: DATE_AND_TIME216602 ! Node: DBLE219063 ! Node: DCMPLX219887 ! Node: DFLOAT221081 ! Node: DIGITS221775 ! Node: DIM222741 ! Node: DOT_PRODUCT223884 ! Node: DPROD225540 ! Node: DREAL226266 ! Node: DTIME226930 ! Node: EOSHIFT229731 ! Node: EPSILON231804 ! Node: ERF232530 ! Node: ERFC233304 ! Node: ERFC_SCALED234108 ! Node: ETIME234800 ! Node: EXIT237025 ! Node: EXP237884 ! Node: EXPONENT239042 ! Node: FDATE239792 ! Node: FLOAT241067 ! Node: FGET241781 ! Node: FGETC243575 ! Node: FLOOR245343 ! Node: FLUSH246327 ! Node: FNUM246965 ! Node: FPUT247687 ! Node: FPUTC249288 ! Node: FRACTION251028 ! Node: FREE251929 ! Node: FSEEK252766 ! Node: FSTAT255060 ! Node: FTELL256104 ! Node: GAMMA257082 ! Node: GERROR258123 ! Node: GETARG258842 ! Node: GET_COMMAND260606 ! Node: GET_COMMAND_ARGUMENT261970 ! Node: GETCWD263989 ! Node: GETENV264935 ! Node: GET_ENVIRONMENT_VARIABLE266157 ! Node: GETGID268022 ! Node: GETLOG268557 ! Node: GETPID269415 ! Node: GETUID270143 ! Node: GMTIME270657 ! Node: HOSTNM272146 ! Node: HUGE273062 ! Node: HYPOT273781 ! Node: IACHAR274601 ! Node: IAND275781 ! Node: IARGC276768 ! Node: IBCLR277791 ! Node: IBITS278452 ! Node: IBSET279367 ! Node: ICHAR280023 ! Node: IDATE282004 ! Node: IEOR283031 ! Node: IERRNO283907 ! Node: INDEX intrinsic284462 ! Node: INT285808 ! Node: INT2287395 ! Node: INT8288160 ! Node: IOR288872 ! Node: IRAND289722 ! Node: IS_IOSTAT_END291074 ! Node: IS_IOSTAT_EOR292169 ! Node: ISATTY293294 ! Node: ISHFT294077 ! Node: ISHFTC295057 ! Node: ISNAN296273 ! Node: ITIME297021 ! Node: KILL298046 ! Node: KIND298919 ! Node: LBOUND299764 ! Node: LEADZ301076 ! Node: LEN301880 ! Node: LEN_TRIM302971 ! Node: LGE303953 ! Node: LGT305265 ! Node: LINK306542 ! Node: LLE307577 ! Node: LLT308881 ! Node: LNBLNK310151 ! Node: LOC310927 ! Node: LOG311658 ! Node: LOG10312949 ! Node: LOG_GAMMA313923 ! Node: LOGICAL315012 ! Node: LONG315820 ! Node: LSHIFT316576 ! Node: LSTAT317530 ! Node: LTIME318688 ! Node: MALLOC320101 ! Node: MATMUL321561 ! Node: MAX322651 ! Node: MAXEXPONENT324150 ! Node: MAXLOC324966 ! Node: MAXVAL326985 ! Node: MCLOCK328618 ! Node: MCLOCK8329621 ! Node: MERGE330835 ! Node: MIN331577 ! Node: MINEXPONENT333073 ! Node: MINLOC333703 ! Node: MINVAL335722 ! Node: MOD337374 ! Node: MODULO338866 ! Node: MOVE_ALLOC340080 ! Node: MVBITS341104 ! Node: NEAREST342163 ! Node: NEW_LINE343286 ! Node: NINT344057 ! Node: NOT345325 ! Node: NULL345908 ! Node: OR346806 ! Node: PACK348084 ! Node: PERROR350076 ! Node: PRECISION350698 ! Node: PRESENT351524 ! Node: PRODUCT352630 ! Node: RADIX354155 ! Node: RAN354932 ! Node: RAND355388 ! Node: RANDOM_NUMBER356720 ! Node: RANDOM_SEED358438 ! Node: RANGE360323 ! Node: REAL360947 ! Node: RENAME362386 ! Node: REPEAT363405 ! Node: RESHAPE364131 ! Node: RRSPACING365600 ! Node: RSHIFT366293 ! Node: SCALE367255 ! Node: SCAN368029 ! Node: SECNDS369579 ! Node: SECOND370667 ! Node: SELECTED_CHAR_KIND371543 ! Node: SELECTED_INT_KIND372540 ! Node: SELECTED_REAL_KIND373715 ! Node: SET_EXPONENT375656 ! Node: SHAPE376652 ! Node: SIGN377765 ! Node: SIGNAL378848 ! Node: SIN380345 ! Node: SINH381387 ! Node: SIZE382268 ! Node: SIZEOF383576 ! Node: SLEEP384870 ! Node: SNGL385427 ! Node: SPACING386098 ! Node: SPREAD387110 ! Node: SQRT388255 ! Node: SRAND389494 ! Node: STAT390662 ! Node: SUM393785 ! Node: SYMLNK395259 ! Node: SYSTEM396391 ! Node: SYSTEM_CLOCK397339 ! Node: TAN398683 ! Node: TANH399540 ! Node: TIME400576 ! Node: TIME8401680 ! Node: TINY402817 ! Node: TRAILZ403417 ! Node: TRANSFER404202 ! Node: TRANSPOSE406236 ! Node: TRIM406923 ! Node: TTYNAM407780 ! Node: UBOUND408695 ! Node: UMASK410064 ! Node: UNLINK410735 ! Node: UNPACK411712 ! Node: VERIFY413000 ! Node: XOR414716 ! Node: Intrinsic Modules416088 ! Node: ISO_FORTRAN_ENV416331 ! Node: ISO_C_BINDING417976 ! Node: OpenMP Modules OMP_LIB and OMP_LIB_KINDS421645 ! Node: Contributing422605 ! Node: Contributors423457 ! Node: Projects425124 ! Node: Proposed Extensions425927 ! Node: Copying427978 ! Node: GNU Free Documentation License465542 ! Node: Funding487954 ! Node: Option Index490479 ! Node: Keyword Index502721  End Tag Table --- 15587,15909 ----  Tag Table: ! Node: Top2126 ! Node: Introduction3504 ! Node: About GNU Fortran4251 ! Node: GNU Fortran and GCC8238 ! Node: Preprocessing and conditional compilation10350 ! Node: GNU Fortran and G7711991 ! Node: Project Status12564 ! Node: Standards15096 ! Node: Varying Length Character Strings16492 ! Node: Invoking GNU Fortran17026 ! Node: Option Summary18749 ! Node: Fortran Dialect Options22378 ! Node: Preprocessing Options29416 ! Node: Error and Warning Options37542 ! Node: Debugging Options45176 ! Node: Directory Options47339 ! Node: Link Options48854 ! Node: Runtime Options49478 ! Node: Code Gen Options51727 ! Node: Environment Variables66487 ! Node: Runtime67092 ! Node: GFORTRAN_STDIN_UNIT68320 ! Node: GFORTRAN_STDOUT_UNIT68687 ! Node: GFORTRAN_STDERR_UNIT69088 ! Node: GFORTRAN_USE_STDERR69486 ! Node: GFORTRAN_TMPDIR69931 ! Node: GFORTRAN_UNBUFFERED_ALL70372 ! Node: GFORTRAN_UNBUFFERED_PRECONNECTED70895 ! Node: GFORTRAN_SHOW_LOCUS71537 ! Node: GFORTRAN_OPTIONAL_PLUS72031 ! Node: GFORTRAN_DEFAULT_RECL72506 ! Node: GFORTRAN_LIST_SEPARATOR72997 ! Node: GFORTRAN_CONVERT_UNIT73606 ! Node: GFORTRAN_ERROR_DUMPCORE76468 ! Node: GFORTRAN_ERROR_BACKTRACE77015 ! Node: Fortran 2003 and 2008 status77566 ! Node: Fortran 2003 status77806 ! Node: Fortran 2008 status80175 ! Node: Compiler Characteristics81276 ! Node: KIND Type Parameters81751 ! Node: Internal representation of LOGICAL variables82731 ! Node: Extensions84042 ! Node: Extensions implemented in GNU Fortran84643 ! Node: Old-style kind specifications85977 ! Node: Old-style variable initialization87083 ! Node: Extensions to namelist88395 ! Node: X format descriptor without count field90391 ! Node: Commas in FORMAT specifications90918 ! Node: Missing period in FORMAT specifications91435 ! Node: I/O item lists91997 ! Node: BOZ literal constants92386 ! Node: Real array indices94956 ! Node: Unary operators95253 ! Node: Implicitly convert LOGICAL and INTEGER values95667 ! Node: Hollerith constants support96627 ! Node: Cray pointers98399 ! Node: CONVERT specifier103809 ! Node: OpenMP105807 ! Node: Argument list functions108054 ! Node: Extensions not implemented in GNU Fortran109658 ! Node: STRUCTURE and RECORD110542 ! Node: ENCODE and DECODE statements112598 ! Node: Variable FORMAT expressions113956 ! Node: Mixed-Language Programming115013 ! Node: Interoperability with C115556 ! Node: Intrinsic Types116863 ! Node: Derived Types and struct117394 ! Node: Interoperable Global Variables118775 ! Node: Interoperable Subroutines and Functions120047 ! Node: Further Interoperability of Fortran with C124600 ! Node: GNU Fortran Compiler Directives125606 ! Node: Non-Fortran Main Program127803 ! Node: _gfortran_set_args129941 ! Node: _gfortran_set_options130875 ! Node: _gfortran_set_convert133711 ! Node: _gfortran_set_record_marker134575 ! Node: _gfortran_set_fpe135399 ! Node: _gfortran_set_max_subrecord_length136611 ! Node: Intrinsic Procedures137566 ! Node: Introduction to Intrinsics151256 ! Node: ABORT153608 ! Node: ABS154365 ! Node: ACCESS155867 ! Node: ACHAR157788 ! Node: ACOS158989 ! Node: ACOSH160111 ! Node: ADJUSTL161112 ! Node: ADJUSTR162053 ! Node: AIMAG163000 ! Node: AINT164320 ! Node: ALARM165792 ! Node: ALL167426 ! Node: ALLOCATED169344 ! Node: AND170225 ! Node: ANINT171522 ! Node: ANY172885 ! Node: ASIN174815 ! Node: ASINH175926 ! Node: ASSOCIATED176937 ! Node: ATAN179942 ! Node: ATAN2181241 ! Node: ATANH182762 ! Node: BESSEL_J0183771 ! Node: BESSEL_J1184815 ! Node: BESSEL_JN185867 ! Node: BESSEL_Y0187082 ! Node: BESSEL_Y1188082 ! Node: BESSEL_YN189082 ! Node: BIT_SIZE190299 ! Node: BTEST191128 ! Node: C_ASSOCIATED192016 ! Node: C_FUNLOC193225 ! Node: C_F_PROCPOINTER194594 ! Node: C_F_POINTER196095 ! Node: C_LOC197513 ! Node: C_SIZEOF198630 ! Node: CEILING199983 ! Node: CHAR200988 ! Node: CHDIR202052 ! Node: CHMOD203220 ! Node: CMPLX205015 ! Node: COMMAND_ARGUMENT_COUNT206479 ! Node: COMPLEX207395 ! Node: CONJG208538 ! Node: COS209548 ! Node: COSH210879 ! Node: COUNT211929 ! Node: CPU_TIME213945 ! Node: CSHIFT215299 ! Node: CTIME216955 ! Node: DATE_AND_TIME218214 ! Node: DBLE220675 ! Node: DCMPLX221499 ! Node: DFLOAT222693 ! Node: DIGITS223387 ! Node: DIM224353 ! Node: DOT_PRODUCT225496 ! Node: DPROD227152 ! Node: DREAL227878 ! Node: DTIME228542 ! Node: EOSHIFT231343 ! Node: EPSILON233416 ! Node: ERF234142 ! Node: ERFC234916 ! Node: ERFC_SCALED235720 ! Node: ETIME236412 ! Node: EXIT238637 ! Node: EXP239496 ! Node: EXPONENT240654 ! Node: FDATE241404 ! Node: FLOAT242679 ! Node: FGET243393 ! Node: FGETC245187 ! Node: FLOOR246955 ! Node: FLUSH247939 ! Node: FNUM248577 ! Node: FPUT249299 ! Node: FPUTC250900 ! Node: FRACTION252640 ! Node: FREE253541 ! Node: FSEEK254378 ! Node: FSTAT256672 ! Node: FTELL257716 ! Node: GAMMA258694 ! Node: GERROR259735 ! Node: GETARG260454 ! Node: GET_COMMAND262218 ! Node: GET_COMMAND_ARGUMENT263582 ! Node: GETCWD265601 ! Node: GETENV266547 ! Node: GET_ENVIRONMENT_VARIABLE267769 ! Node: GETGID269634 ! Node: GETLOG270169 ! Node: GETPID271027 ! Node: GETUID271755 ! Node: GMTIME272269 ! Node: HOSTNM273758 ! Node: HUGE274674 ! Node: HYPOT275393 ! Node: IACHAR276213 ! Node: IAND277393 ! Node: IARGC278380 ! Node: IBCLR279403 ! Node: IBITS280064 ! Node: IBSET280979 ! Node: ICHAR281635 ! Node: IDATE283616 ! Node: IEOR284643 ! Node: IERRNO285519 ! Node: INDEX intrinsic286074 ! Node: INT287420 ! Node: INT2289007 ! Node: INT8289772 ! Node: IOR290484 ! Node: IRAND291334 ! Node: IS_IOSTAT_END292686 ! Node: IS_IOSTAT_EOR293781 ! Node: ISATTY294906 ! Node: ISHFT295689 ! Node: ISHFTC296669 ! Node: ISNAN297885 ! Node: ITIME298633 ! Node: KILL299658 ! Node: KIND300531 ! Node: LBOUND301376 ! Node: LEADZ302688 ! Node: LEN303492 ! Node: LEN_TRIM304583 ! Node: LGE305565 ! Node: LGT306877 ! Node: LINK308154 ! Node: LLE309189 ! Node: LLT310493 ! Node: LNBLNK311763 ! Node: LOC312539 ! Node: LOG313270 ! Node: LOG10314561 ! Node: LOG_GAMMA315535 ! Node: LOGICAL316624 ! Node: LONG317432 ! Node: LSHIFT318188 ! Node: LSTAT319142 ! Node: LTIME320300 ! Node: MALLOC321713 ! Node: MATMUL323173 ! Node: MAX324263 ! Node: MAXEXPONENT325762 ! Node: MAXLOC326578 ! Node: MAXVAL328597 ! Node: MCLOCK330230 ! Node: MCLOCK8331233 ! Node: MERGE332447 ! Node: MIN333189 ! Node: MINEXPONENT334685 ! Node: MINLOC335315 ! Node: MINVAL337334 ! Node: MOD338986 ! Node: MODULO340478 ! Node: MOVE_ALLOC341692 ! Node: MVBITS342716 ! Node: NEAREST343775 ! Node: NEW_LINE344898 ! Node: NINT345669 ! Node: NOT346937 ! Node: NULL347520 ! Node: OR348418 ! Node: PACK349696 ! Node: PERROR351688 ! Node: PRECISION352310 ! Node: PRESENT353136 ! Node: PRODUCT354242 ! Node: RADIX355767 ! Node: RAN356544 ! Node: RAND357000 ! Node: RANDOM_NUMBER358332 ! Node: RANDOM_SEED360050 ! Node: RANGE361935 ! Node: REAL362559 ! Node: RENAME363998 ! Node: REPEAT365017 ! Node: RESHAPE365743 ! Node: RRSPACING367212 ! Node: RSHIFT367905 ! Node: SCALE368867 ! Node: SCAN369641 ! Node: SECNDS371191 ! Node: SECOND372279 ! Node: SELECTED_CHAR_KIND373155 ! Node: SELECTED_INT_KIND374152 ! Node: SELECTED_REAL_KIND375327 ! Node: SET_EXPONENT377268 ! Node: SHAPE378264 ! Node: SIGN379377 ! Node: SIGNAL380460 ! Node: SIN381957 ! Node: SINH382999 ! Node: SIZE383880 ! Node: SIZEOF385188 ! Node: SLEEP386482 ! Node: SNGL387039 ! Node: SPACING387710 ! Node: SPREAD388722 ! Node: SQRT389867 ! Node: SRAND391106 ! Node: STAT392274 ! Node: SUM395397 ! Node: SYMLNK396871 ! Node: SYSTEM398003 ! Node: SYSTEM_CLOCK398951 ! Node: TAN400295 ! Node: TANH401152 ! Node: TIME402188 ! Node: TIME8403292 ! Node: TINY404429 ! Node: TRAILZ405029 ! Node: TRANSFER405814 ! Node: TRANSPOSE407848 ! Node: TRIM408535 ! Node: TTYNAM409392 ! Node: UBOUND410307 ! Node: UMASK411676 ! Node: UNLINK412347 ! Node: UNPACK413324 ! Node: VERIFY414612 ! Node: XOR416328 ! Node: Intrinsic Modules417700 ! Node: ISO_FORTRAN_ENV417943 ! Node: ISO_C_BINDING419588 ! Node: OpenMP Modules OMP_LIB and OMP_LIB_KINDS423257 ! Node: Contributing424217 ! Node: Contributors425069 ! Node: Projects426736 ! Node: Proposed Extensions427539 ! Node: Copying429590 ! Node: GNU Free Documentation License467154 ! Node: Funding489566 ! Node: Option Index492091 ! Node: Keyword Index504333  End Tag Table diff -Nrcpad gcc-4.5.0/gcc/fortran/gfortran.texi gcc-4.5.1/gcc/fortran/gfortran.texi *** gcc-4.5.0/gcc/fortran/gfortran.texi Wed Dec 16 00:54:44 2009 --- gcc-4.5.1/gcc/fortran/gfortran.texi Tue Jun 15 16:30:58 2010 *************** *** 1,7 **** \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename gfortran.info ! @set copyrights-gfortran 1999-2008 @include gcc-common.texi --- 1,7 ---- \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename gfortran.info ! @set copyrights-gfortran 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 @include gcc-common.texi *************** Part I: Invoking GNU Fortran *** 181,187 **** Part II: Language Reference * Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. ! * Compiler Characteristics:: KIND type parameters supported. * Mixed-Language Programming:: Interoperability with C * Extensions:: Language extensions implemented by GNU Fortran. * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran. --- 181,187 ---- Part II: Language Reference * Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. ! * Compiler Characteristics:: User-visible implementation details. * Mixed-Language Programming:: Interoperability with C * Extensions:: Language extensions implemented by GNU Fortran. * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran. *************** about the current Fortran 2008 implement *** 962,975 **** @node Compiler Characteristics @chapter Compiler Characteristics ! @c TODO: Formulate this introduction a little more generally once ! @c there is more here than KIND type parameters. ! ! This chapter describes certain characteristics of the GNU Fortran compiler, ! namely the KIND type parameter values supported. @menu * KIND Type Parameters:: @end menu --- 962,974 ---- @node Compiler Characteristics @chapter Compiler Characteristics ! This chapter describes certain characteristics of the GNU Fortran ! compiler, that are not specified by the Fortran standard, but which ! might in some way or another become visible to the programmer. @menu * KIND Type Parameters:: + * Internal representation of LOGICAL variables:: @end menu *************** imaginary part are a real value of the g *** 1013,1018 **** --- 1012,1043 ---- the @code{SELECT_*_KIND} intrinsics instead of the concrete values. + @node Internal representation of LOGICAL variables + @section Internal representation of LOGICAL variables + @cindex logical, variable representation + + The Fortran standard does not specify how variables of @code{LOGICAL} + type are represented, beyond requiring that @code{LOGICAL} variables + of default kind have the same storage size as default @code{INTEGER} + and @code{REAL} variables. The GNU Fortran internal representation is + as follows. + + A @code{LOGICAL(KIND=N)} variable is represented as an + @code{INTEGER(KIND=N)} variable, however, with only two permissible + values: @code{1} for @code{.TRUE.} and @code{0} for + @code{.FALSE.}. Any other integer value results in undefined behavior. + + Note that for mixed-language programming using the + @code{ISO_C_BINDING} feature, there is a @code{C_BOOL} kind that can + be used to create @code{LOGICAL(KIND=C_BOOL)} variables which are + interoperable with the C99 _Bool type. The C99 _Bool type has an + internal representation described in the C99 standard, which is + identical to the above description, i.e. with 1 for true and 0 for + false being the only permissible values. Thus the internal + representation of @code{LOGICAL} variables in GNU Fortran is identical + to C99 _Bool, except for a possible difference in storage size + depending on the kind. + @c --------------------------------------------------------------------- @c Extensions @c --------------------------------------------------------------------- diff -Nrcpad gcc-4.5.0/gcc/fortran/interface.c gcc-4.5.1/gcc/fortran/interface.c *** gcc-4.5.0/gcc/fortran/interface.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/interface.c Fri May 14 21:17:42 2010 *************** get_sym_storage_size (gfc_symbol *sym) *** 1582,1589 **** || sym->as->lower[i]->expr_type != EXPR_CONSTANT) return 0; ! elements *= mpz_get_ui (sym->as->upper[i]->value.integer) ! - mpz_get_ui (sym->as->lower[i]->value.integer) + 1L; } return strlen*elements; --- 1582,1589 ---- || sym->as->lower[i]->expr_type != EXPR_CONSTANT) return 0; ! elements *= mpz_get_si (sym->as->upper[i]->value.integer) ! - mpz_get_si (sym->as->lower[i]->value.integer) + 1L; } return strlen*elements; diff -Nrcpad gcc-4.5.0/gcc/fortran/intrinsic.c gcc-4.5.1/gcc/fortran/intrinsic.c *** gcc-4.5.0/gcc/fortran/intrinsic.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/intrinsic.c Wed Jun 9 16:33:00 2010 *************** gfc_is_intrinsic (gfc_symbol* sym, int s *** 956,972 **** /* 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); ! } return false; } --- 956,969 ---- /* 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 ! && 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; } *************** add_functions (void) *** 1356,1362 **** 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, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("btest", GFC_ISYM_BTEST, GFC_STD_F95); --- 1353,1359 ---- 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_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); *************** add_functions (void) *** 1742,1748 **** 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, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("ibclr", GFC_ISYM_IBCLR, GFC_STD_F95); --- 1739,1745 ---- 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_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); *************** add_functions (void) *** 1755,1761 **** 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, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95); --- 1752,1758 ---- 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_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); *************** keywords: *** 3264,3270 **** if (f->actual != NULL) { ! gfc_error ("Argument '%s' is appears twice in call to '%s' at %L", f->name, name, where); return FAILURE; } --- 3261,3267 ---- if (f->actual != NULL) { ! gfc_error ("Argument '%s' appears twice in call to '%s' at %L", f->name, name, where); return FAILURE; } diff -Nrcpad gcc-4.5.0/gcc/fortran/intrinsic.h gcc-4.5.1/gcc/fortran/intrinsic.h *** gcc-4.5.0/gcc/fortran/intrinsic.h Mon Nov 30 20:43:06 2009 --- gcc-4.5.1/gcc/fortran/intrinsic.h Wed Jun 9 16:33:00 2010 *************** gfc_try gfc_check_associated (gfc_expr * *** 40,46 **** gfc_try gfc_check_atan_2 (gfc_expr *, gfc_expr *); gfc_try gfc_check_atan2 (gfc_expr *, gfc_expr *); gfc_try gfc_check_besn (gfc_expr *, gfc_expr *); ! gfc_try gfc_check_btest (gfc_expr *, gfc_expr *); gfc_try gfc_check_char (gfc_expr *, gfc_expr *); gfc_try gfc_check_chdir (gfc_expr *); gfc_try gfc_check_chmod (gfc_expr *, gfc_expr *); --- 40,46 ---- gfc_try gfc_check_atan_2 (gfc_expr *, gfc_expr *); gfc_try gfc_check_atan2 (gfc_expr *, gfc_expr *); gfc_try gfc_check_besn (gfc_expr *, gfc_expr *); ! gfc_try gfc_check_bitfcn (gfc_expr *, gfc_expr *); gfc_try gfc_check_char (gfc_expr *, gfc_expr *); gfc_try gfc_check_chdir (gfc_expr *); gfc_try gfc_check_chmod (gfc_expr *, gfc_expr *); *************** gfc_try gfc_check_hypot (gfc_expr *, gfc *** 73,81 **** gfc_try gfc_check_i (gfc_expr *); gfc_try gfc_check_iand (gfc_expr *, gfc_expr *); gfc_try gfc_check_and (gfc_expr *, gfc_expr *); - gfc_try gfc_check_ibclr (gfc_expr *, gfc_expr *); gfc_try gfc_check_ibits (gfc_expr *, gfc_expr *, gfc_expr *); - gfc_try gfc_check_ibset (gfc_expr *, gfc_expr *); gfc_try gfc_check_ichar_iachar (gfc_expr *, gfc_expr *); gfc_try gfc_check_idnint (gfc_expr *); gfc_try gfc_check_ieor (gfc_expr *, gfc_expr *); --- 73,79 ---- diff -Nrcpad gcc-4.5.0/gcc/fortran/match.c gcc-4.5.1/gcc/fortran/match.c *** gcc-4.5.0/gcc/fortran/match.c Mon Dec 7 17:32:29 2009 --- gcc-4.5.1/gcc/fortran/match.c Wed Jul 21 22:47:36 2010 *************** match_exit_cycle (gfc_statement st, gfc_ *** 1843,1848 **** --- 1843,1849 ---- gfc_state_data *p, *o; gfc_symbol *sym; match m; + int cnt; if (gfc_match_eos () == MATCH_YES) sym = NULL; *************** match_exit_cycle (gfc_statement st, gfc_ *** 1865,1871 **** } } ! /* Find the loop mentioned specified by the label (or lack of a label). */ for (o = NULL, p = gfc_state_stack; p; p = p->previous) if (p->state == COMP_DO && (sym == NULL || sym == p->sym)) break; --- 1866,1872 ---- } } ! /* Find the loop specified by the label (or lack of a label). */ for (o = NULL, p = gfc_state_stack; p; p = p->previous) if (p->state == COMP_DO && (sym == NULL || sym == p->sym)) break; *************** match_exit_cycle (gfc_statement st, gfc_ *** 1890,1906 **** gfc_ascii_statement (st)); return MATCH_ERROR; } ! else if (st == ST_EXIT ! && p->previous != NULL ! && p->previous->state == COMP_OMP_STRUCTURED_BLOCK ! && (p->previous->head->op == EXEC_OMP_DO ! || p->previous->head->op == EXEC_OMP_PARALLEL_DO)) { ! gcc_assert (p->previous->head->next != NULL); ! gcc_assert (p->previous->head->next->op == EXEC_DO ! || p->previous->head->next->op == EXEC_DO_WHILE); ! gfc_error ("EXIT statement at %C terminating !$OMP DO loop"); ! return MATCH_ERROR; } /* Save the first statement in the loop - needed by the backend. */ --- 1891,1924 ---- gfc_ascii_statement (st)); return MATCH_ERROR; } ! ! for (o = p, cnt = 0; o->state == COMP_DO && o->previous != NULL; cnt++) ! o = o->previous; ! if (cnt > 0 ! && o != NULL ! && o->state == COMP_OMP_STRUCTURED_BLOCK ! && (o->head->op == EXEC_OMP_DO ! || o->head->op == EXEC_OMP_PARALLEL_DO)) { ! int collapse = 1; ! gcc_assert (o->head->next != NULL ! && (o->head->next->op == EXEC_DO ! || o->head->next->op == EXEC_DO_WHILE) ! && o->previous != NULL ! && o->previous->tail->op == o->head->op); ! if (o->previous->tail->ext.omp_clauses != NULL ! && o->previous->tail->ext.omp_clauses->collapse > 1) ! collapse = o->previous->tail->ext.omp_clauses->collapse; ! if (st == ST_EXIT && cnt <= collapse) ! { ! gfc_error ("EXIT statement at %C terminating !$OMP DO loop"); ! return MATCH_ERROR; ! } ! if (st == ST_CYCLE && cnt < collapse) ! { ! gfc_error ("CYCLE statement at %C to non-innermost collapsed !$OMP DO loop"); ! return MATCH_ERROR; ! } } /* Save the first statement in the loop - needed by the backend. */ diff -Nrcpad gcc-4.5.0/gcc/fortran/openmp.c gcc-4.5.1/gcc/fortran/openmp.c *** gcc-4.5.0/gcc/fortran/openmp.c Thu Aug 13 19:46:46 2009 --- gcc-4.5.1/gcc/fortran/openmp.c Thu May 13 12:35:52 2010 *************** *** 1,5 **** /* OpenMP directive matching and resolving. ! Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Jakub Jelinek --- 1,5 ---- /* OpenMP directive matching and resolving. ! Copyright (C) 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. Contributed by Jakub Jelinek *************** resolve_omp_clauses (gfc_code *code) *** 812,817 **** --- 812,819 ---- if (el) continue; } + if (n->sym->attr.proc_pointer) + continue; } gfc_error ("Object '%s' is not a variable at %L", n->sym->name, &code->loc); *************** gfc_resolve_omp_parallel_blocks (gfc_cod *** 1367,1373 **** void gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym) { - struct omp_context *ctx; int i = omp_current_do_collapse; gfc_code *c = omp_current_do_code; --- 1369,1374 ---- *************** gfc_resolve_do_iterator (gfc_code *code, *** 1386,1406 **** c = c->block->next; } ! for (ctx = omp_current_ctx; ctx; ctx = ctx->previous) ! { ! if (pointer_set_contains (ctx->sharing_clauses, sym)) ! continue; ! if (! pointer_set_insert (ctx->private_iterators, sym)) ! { ! gfc_omp_clauses *omp_clauses = ctx->code->ext.omp_clauses; ! gfc_namelist *p; ! p = gfc_get_namelist (); ! p->sym = sym; ! p->next = omp_clauses->lists[OMP_LIST_PRIVATE]; ! omp_clauses->lists[OMP_LIST_PRIVATE] = p; ! } } } --- 1387,1407 ---- c = c->block->next; } ! if (omp_current_ctx == NULL) ! return; ! if (pointer_set_contains (omp_current_ctx->sharing_clauses, sym)) ! return; ! if (! pointer_set_insert (omp_current_ctx->private_iterators, sym)) ! { ! gfc_omp_clauses *omp_clauses = omp_current_ctx->code->ext.omp_clauses; ! gfc_namelist *p; ! ! p = gfc_get_namelist (); ! p->sym = sym; ! p->next = omp_clauses->lists[OMP_LIST_PRIVATE]; ! omp_clauses->lists[OMP_LIST_PRIVATE] = p; } } diff -Nrcpad gcc-4.5.0/gcc/fortran/parse.c gcc-4.5.1/gcc/fortran/parse.c *** gcc-4.5.0/gcc/fortran/parse.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/parse.c Wed Jun 2 06:06:07 2010 *************** loop: *** 2235,2243 **** { if (current_state == COMP_NONE) { ! if (new_state == COMP_FUNCTION) gfc_add_function (&sym->attr, sym->name, NULL); ! else if (new_state == COMP_SUBROUTINE) gfc_add_subroutine (&sym->attr, sym->name, NULL); current_state = new_state; --- 2235,2243 ---- { if (current_state == COMP_NONE) { ! if (new_state == COMP_FUNCTION && sym) gfc_add_function (&sym->attr, sym->name, NULL); ! else if (new_state == COMP_SUBROUTINE && sym) gfc_add_subroutine (&sym->attr, sym->name, NULL); current_state = new_state; *************** gfc_fixup_sibling_symbols (gfc_symbol *s *** 3594,3599 **** --- 3594,3600 ---- || (old_sym->ts.type != BT_UNKNOWN && !old_sym->attr.implicit_type) || old_sym->attr.flavor == FL_PARAMETER + || old_sym->attr.use_assoc || old_sym->attr.in_common || old_sym->attr.in_equivalence || old_sym->attr.data diff -Nrcpad gcc-4.5.0/gcc/fortran/resolve.c gcc-4.5.1/gcc/fortran/resolve.c *** gcc-4.5.0/gcc/fortran/resolve.c Thu Mar 18 21:23:35 2010 --- gcc-4.5.1/gcc/fortran/resolve.c Sun Jul 18 20:49:30 2010 *************** resolve_global_procedure (gfc_symbol *sy *** 1808,1816 **** && not_in_recursive (sym, gsym->ns) && not_entry_self_reference (sym, gsym->ns)) { /* Make sure that translation for the gsymbol occurs before the procedure currently being resolved. */ ! ns = gsym->ns->resolved ? NULL : gfc_global_ns_list; for (; ns && ns != gsym->ns; ns = ns->sibling) { if (ns->sibling == gsym->ns) --- 1808,1836 ---- && not_in_recursive (sym, gsym->ns) && not_entry_self_reference (sym, gsym->ns)) { + /* Resolve the gsymbol namespace if needed. */ + if (!gsym->ns->resolved) + { + gfc_dt_list *old_dt_list; + + /* Stash away derived types so that the backend_decls do not + get mixed up. */ + old_dt_list = gfc_derived_types; + gfc_derived_types = NULL; + + gfc_resolve (gsym->ns); + + /* Store the new derived types with the global namespace. */ + if (gfc_derived_types) + gsym->ns->derived_types = gfc_derived_types; + + /* Restore the derived types of this namespace. */ + gfc_derived_types = old_dt_list; + } + /* Make sure that translation for the gsymbol occurs before the procedure currently being resolved. */ ! ns = gfc_global_ns_list; for (; ns && ns != gsym->ns; ns = ns->sibling) { if (ns->sibling == gsym->ns) *************** resolve_global_procedure (gfc_symbol *sy *** 1822,1874 **** } } ! if (!gsym->ns->resolved) { ! gfc_dt_list *old_dt_list; ! /* Stash away derived types so that the backend_decls do not ! get mixed up. */ ! old_dt_list = gfc_derived_types; ! gfc_derived_types = NULL; ! gfc_resolve (gsym->ns); ! /* Store the new derived types with the global namespace. */ ! if (gfc_derived_types) ! gsym->ns->derived_types = gfc_derived_types; ! /* Restore the derived types of this namespace. */ ! gfc_derived_types = old_dt_list; } ! if (gsym->ns->proc_name->attr.function ! && gsym->ns->proc_name->as ! && gsym->ns->proc_name->as->rank ! && (!sym->as || sym->as->rank != gsym->ns->proc_name->as->rank)) ! gfc_error ("The reference to function '%s' at %L either needs an " ! "explicit INTERFACE or the rank is incorrect", sym->name, ! where); ! ! /* Non-assumed length character functions. */ ! if (sym->attr.function && sym->ts.type == BT_CHARACTER ! && gsym->ns->proc_name->ts.u.cl != NULL ! && gsym->ns->proc_name->ts.u.cl->length != NULL) { ! gfc_charlen *cl = sym->ts.u.cl; ! if (!sym->attr.entry_master && sym->attr.if_source == IFSRC_UNKNOWN ! && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT) { ! gfc_error ("Nonconstant character-length function '%s' at %L " ! "must have an explicit interface", sym->name, ! &sym->declared_at); } } if (gfc_option.flag_whole_file == 1 ! || ((gfc_option.warn_std & GFC_STD_LEGACY) ! && ! !(gfc_option.warn_std & GFC_STD_GNU))) gfc_errors_to_warnings (1); gfc_procedure_use (gsym->ns->proc_name, actual, where); --- 1842,1984 ---- } } ! /* Differences in constant character lengths. */ ! if (sym->attr.function && sym->ts.type == BT_CHARACTER) { ! long int l1 = 0, l2 = 0; ! gfc_charlen *cl1 = sym->ts.u.cl; ! gfc_charlen *cl2 = gsym->ns->proc_name->ts.u.cl; ! if (cl1 != NULL ! && cl1->length != NULL ! && cl1->length->expr_type == EXPR_CONSTANT) ! l1 = mpz_get_si (cl1->length->value.integer); ! if (cl2 != NULL ! && cl2->length != NULL ! && cl2->length->expr_type == EXPR_CONSTANT) ! l2 = mpz_get_si (cl2->length->value.integer); ! if (l1 && l2 && l1 != l2) ! gfc_error ("Character length mismatch in return type of " ! "function '%s' at %L (%ld/%ld)", sym->name, ! &sym->declared_at, l1, l2); ! } ! /* Type mismatch of function return type and expected type. */ ! if (sym->attr.function ! && !gfc_compare_types (&sym->ts, &gsym->ns->proc_name->ts)) ! gfc_error ("Return type mismatch of function '%s' at %L (%s/%s)", ! sym->name, &sym->declared_at, gfc_typename (&sym->ts), ! gfc_typename (&gsym->ns->proc_name->ts)); ! ! if (gsym->ns->proc_name->formal) ! { ! gfc_formal_arglist *arg = gsym->ns->proc_name->formal; ! for ( ; arg; arg = arg->next) ! if (!arg->sym) ! continue; ! /* F2003, 12.3.1.1 (2a); F2008, 12.4.2.2 (2a) */ ! else if (arg->sym->attr.allocatable ! || arg->sym->attr.asynchronous ! || arg->sym->attr.optional ! || arg->sym->attr.pointer ! || arg->sym->attr.target ! || arg->sym->attr.value ! || arg->sym->attr.volatile_) ! { ! gfc_error ("Dummy argument '%s' of procedure '%s' at %L " ! "has an attribute that requires an explicit " ! "interface for this procedure", arg->sym->name, ! sym->name, &sym->declared_at); ! break; ! } ! /* F2003, 12.3.1.1 (2b); F2008, 12.4.2.2 (2b) */ ! else if (arg->sym && arg->sym->as ! && arg->sym->as->type == AS_ASSUMED_SHAPE) ! { ! gfc_error ("Procedure '%s' at %L with assumed-shape dummy " ! "argument '%s' must have an explicit interface", ! sym->name, &sym->declared_at, arg->sym->name); ! break; ! } ! /* F2008, 12.4.2.2 (2c) */ ! else if (false) /* TODO: is co-array */ ! { ! gfc_error ("Procedure '%s' at %L with coarray dummy argument " ! "'%s' must have an explicit interface", ! sym->name, &sym->declared_at, arg->sym->name); ! break; ! } ! /* F2003, 12.3.1.1 (2c); F2008, 12.4.2.2 (2d) */ ! else if (false) /* TODO: is a parametrized derived type */ ! { ! gfc_error ("Procedure '%s' at %L with parametrized derived " ! "type argument '%s' must have an explicit " ! "interface", sym->name, &sym->declared_at, ! arg->sym->name); ! break; ! } ! /* F2003, 12.3.1.1 (2d); F2008, 12.4.2.2 (2e) */ ! else if (arg->sym->ts.type == BT_CLASS) ! { ! gfc_error ("Procedure '%s' at %L with polymorphic dummy " ! "argument '%s' must have an explicit interface", ! sym->name, &sym->declared_at, arg->sym->name); ! break; ! } } ! if (gsym->ns->proc_name->attr.function) { ! /* F2003, 12.3.1.1 (3a); F2008, 12.4.2.2 (3a) */ ! if (gsym->ns->proc_name->as ! && gsym->ns->proc_name->as->rank ! && (!sym->as || sym->as->rank != gsym->ns->proc_name->as->rank)) ! gfc_error ("The reference to function '%s' at %L either needs an " ! "explicit INTERFACE or the rank is incorrect", sym->name, ! where); ! /* F2003, 12.3.1.1 (3b); F2008, 12.4.2.2 (3b) */ ! if (gsym->ns->proc_name->result->attr.pointer ! || gsym->ns->proc_name->result->attr.allocatable) ! gfc_error ("Function '%s' at %L with a POINTER or ALLOCATABLE " ! "result must have an explicit interface", sym->name, ! where); ! ! /* F2003, 12.3.1.1 (3c); F2008, 12.4.2.2 (3c) */ ! if (sym->ts.type == BT_CHARACTER ! && gsym->ns->proc_name->ts.u.cl->length != NULL) { ! gfc_charlen *cl = sym->ts.u.cl; ! ! if (!sym->attr.entry_master && sym->attr.if_source == IFSRC_UNKNOWN ! && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT) ! { ! gfc_error ("Nonconstant character-length function '%s' at %L " ! "must have an explicit interface", sym->name, ! &sym->declared_at); ! } } } + /* F2003, 12.3.1.1 (4); F2008, 12.4.2.2 (4) */ + if (gsym->ns->proc_name->attr.elemental) + { + gfc_error ("ELEMENTAL procedure '%s' at %L must have an explicit " + "interface", sym->name, &sym->declared_at); + } + + /* F2003, 12.3.1.1 (5); F2008, 12.4.2.2 (5) */ + if (gsym->ns->proc_name->attr.is_bind_c) + { + gfc_error ("Procedure '%s' at %L with BIND(C) attribute must have " + "an explicit interface", sym->name, &sym->declared_at); + } + if (gfc_option.flag_whole_file == 1 ! || ((gfc_option.warn_std & GFC_STD_LEGACY) ! && !(gfc_option.warn_std & GFC_STD_GNU))) gfc_errors_to_warnings (1); gfc_procedure_use (gsym->ns->proc_name, actual, where); *************** resolve_variable (gfc_expr *e) *** 4564,4569 **** --- 4674,4688 ---- sym->entry_id = current_entry_id + 1; } + /* If a symbol has been host_associated mark it. This is used latter, + to identify if aliasing is possible via host association. */ + if (sym->attr.flavor == FL_VARIABLE + && gfc_current_ns->parent + && (gfc_current_ns->parent == sym->ns + || (gfc_current_ns->parent->parent + && gfc_current_ns->parent->parent == sym->ns))) + sym->attr.host_assoc = 1; + resolve_procedure: if (t == SUCCESS && resolve_procedure_expression (e) == FAILURE) t = FAILURE; *************** resolve_allocate_deallocate (gfc_code *c *** 6375,6382 **** for (p = code->ext.alloc.list; p; p = p->next) if (p->expr->symtree->n.sym->name == stat->symtree->n.sym->name) ! gfc_error ("Stat-variable at %L shall not be %sd within " ! "the same %s statement", &stat->where, fcn, fcn); } /* Check the errmsg variable. */ --- 6494,6522 ---- for (p = code->ext.alloc.list; p; p = p->next) if (p->expr->symtree->n.sym->name == stat->symtree->n.sym->name) ! { ! gfc_ref *ref1, *ref2; ! bool found = true; ! ! for (ref1 = p->expr->ref, ref2 = stat->ref; ref1 && ref2; ! ref1 = ref1->next, ref2 = ref2->next) ! { ! if (ref1->type != REF_COMPONENT || ref2->type != REF_COMPONENT) ! continue; ! if (ref1->u.c.component->name != ref2->u.c.component->name) ! { ! found = false; ! break; ! } ! } ! ! if (found) ! { ! gfc_error ("Stat-variable at %L shall not be %sd within " ! "the same %s statement", &stat->where, fcn, fcn); ! break; ! } ! } } /* Check the errmsg variable. */ *************** resolve_allocate_deallocate (gfc_code *c *** 6404,6411 **** for (p = code->ext.alloc.list; p; p = p->next) if (p->expr->symtree->n.sym->name == errmsg->symtree->n.sym->name) ! gfc_error ("Errmsg-variable at %L shall not be %sd within " ! "the same %s statement", &errmsg->where, fcn, fcn); } /* Check that an allocate-object appears only once in the statement. --- 6544,6572 ---- for (p = code->ext.alloc.list; p; p = p->next) if (p->expr->symtree->n.sym->name == errmsg->symtree->n.sym->name) ! { ! gfc_ref *ref1, *ref2; ! bool found = true; ! ! for (ref1 = p->expr->ref, ref2 = errmsg->ref; ref1 && ref2; ! ref1 = ref1->next, ref2 = ref2->next) ! { ! if (ref1->type != REF_COMPONENT || ref2->type != REF_COMPONENT) ! continue; ! if (ref1->u.c.component->name != ref2->u.c.component->name) ! { ! found = false; ! break; ! } ! } ! ! if (found) ! { ! gfc_error ("Errmsg-variable at %L shall not be %sd within " ! "the same %s statement", &errmsg->where, fcn, fcn); ! break; ! } ! } } /* Check that an allocate-object appears only once in the statement. *************** ensure_not_abstract_walker (gfc_symbol* *** 10302,10308 **** { gfc_symtree* overriding; overriding = gfc_find_typebound_proc (sub, NULL, st->name, true, NULL); ! gcc_assert (overriding && overriding->n.tb); if (overriding->n.tb->deferred) { gfc_error ("Derived-type '%s' declared at %L must be ABSTRACT because" --- 10463,10471 ---- { gfc_symtree* overriding; overriding = gfc_find_typebound_proc (sub, NULL, st->name, true, NULL); ! if (!overriding) ! return FAILURE; ! gcc_assert (overriding->n.tb); if (overriding->n.tb->deferred) { gfc_error ("Derived-type '%s' declared at %L must be ABSTRACT because" *************** resolve_fl_derived (gfc_symbol *sym) *** 10431,10438 **** /* Copy char length. */ if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl) { ! c->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl); ! gfc_expr_replace_comp (c->ts.u.cl->length, c); } } else if (c->ts.interface->name[0] != '\0') --- 10594,10605 ---- /* Copy char length. */ if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl) { ! gfc_charlen *cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl); ! gfc_expr_replace_comp (cl->length, c); ! if (cl->length && !cl->resolved ! && gfc_resolve_expr (cl->length) == FAILURE) ! return FAILURE; ! c->ts.u.cl = cl; } } else if (c->ts.interface->name[0] != '\0') *************** resolve_symbol (gfc_symbol *sym) *** 10945,10950 **** --- 11112,11120 ---- { sym->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl); gfc_expr_replace_symbols (sym->ts.u.cl->length, sym); + if (sym->ts.u.cl->length && !sym->ts.u.cl->resolved + && gfc_resolve_expr (sym->ts.u.cl->length) == FAILURE) + return; } } else if (sym->ts.interface->name[0] != '\0') diff -Nrcpad gcc-4.5.0/gcc/fortran/trans-array.c gcc-4.5.1/gcc/fortran/trans-array.c *** gcc-4.5.0/gcc/fortran/trans-array.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/trans-array.c Sun Jun 27 16:14:55 2010 *************** gfc_add_loop_ss_code (gfc_loopinfo * loo *** 2046,2054 **** break; case GFC_SS_REFERENCE: ! /* Scalar reference. Evaluate this now. */ gfc_init_se (&se, NULL); ! gfc_conv_expr_reference (&se, ss->expr); gfc_add_block_to_block (&loop->pre, &se.pre); gfc_add_block_to_block (&loop->post, &se.post); --- 2046,2055 ---- break; case GFC_SS_REFERENCE: ! /* Scalar argument to elemental procedure. Evaluate this ! now. */ gfc_init_se (&se, NULL); ! gfc_conv_expr (&se, ss->expr); gfc_add_block_to_block (&loop->pre, &se.pre); gfc_add_block_to_block (&loop->post, &se.post); *************** gfc_trans_array_bound_check (gfc_se * se *** 2316,2325 **** && se->loop->ss->loop_chain->expr->symtree) name = se->loop->ss->loop_chain->expr->symtree->name; - if (!name && se->loop && se->loop->ss && se->loop->ss->loop_chain - && se->loop->ss->loop_chain->expr->symtree) - name = se->loop->ss->loop_chain->expr->symtree->name; - if (!name && se->loop && se->loop->ss && se->loop->ss->expr) { if (se->loop->ss->expr->expr_type == EXPR_FUNCTION --- 2317,2322 ---- *************** gfc_trans_array_bound_check (gfc_se * se *** 2331,2336 **** --- 2328,2336 ---- name = "unnamed constant"; } + if (TREE_CODE (descriptor) == VAR_DECL) + name = IDENTIFIER_POINTER (DECL_NAME (descriptor)); + /* If upper bound is present, include both bounds in the error message. */ if (check_upper) { *************** gfc_conv_ss_startstride (gfc_loopinfo * *** 3355,3367 **** if (size[n]) { tmp3 = fold_build2 (NE_EXPR, boolean_type_node, tmp, size[n]); ! asprintf (&msg, "%s, size mismatch for dimension %d " ! "of array '%s' (%%ld/%%ld)", gfc_msg_bounds, info->dim[n]+1, ss->expr->symtree->name); gfc_trans_runtime_check (true, false, tmp3, &inner, &ss->expr->where, msg, fold_convert (long_integer_type_node, tmp), fold_convert (long_integer_type_node, size[n])); gfc_free (msg); } else --- 3355,3369 ---- if (size[n]) { tmp3 = fold_build2 (NE_EXPR, boolean_type_node, tmp, size[n]); ! asprintf (&msg, "Array bound mismatch for dimension %d " ! "of array '%s' (%%ld/%%ld)", info->dim[n]+1, ss->expr->symtree->name); + gfc_trans_runtime_check (true, false, tmp3, &inner, &ss->expr->where, msg, fold_convert (long_integer_type_node, tmp), fold_convert (long_integer_type_node, size[n])); + gfc_free (msg); } else *************** gfc_trans_dummy_array_bias (gfc_symbol * *** 4608,4622 **** { /* Check (ubound(a) - lbound(a) == ubound(b) - lbound(b)). */ char * msg; ! tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, ! ubound, lbound); ! stride2 = fold_build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); ! tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2); ! asprintf (&msg, "%s for dimension %d of array '%s'", ! gfc_msg_bounds, n+1, sym->name); ! gfc_trans_runtime_check (true, false, tmp, &block, &loc, msg); gfc_free (msg); } } --- 4610,4635 ---- { /* Check (ubound(a) - lbound(a) == ubound(b) - lbound(b)). */ char * msg; + tree temp; ! temp = fold_build2 (MINUS_EXPR, gfc_array_index_type, ! ubound, lbound); ! temp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ! gfc_index_one_node, temp); ! ! stride2 = fold_build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); ! stride2 = fold_build2 (PLUS_EXPR, gfc_array_index_type, ! gfc_index_one_node, stride2); ! ! tmp = fold_build2 (NE_EXPR, gfc_array_index_type, temp, stride2); ! asprintf (&msg, "Dimension %d of array '%s' has extent " ! "%%ld instead of %%ld", n+1, sym->name); ! ! gfc_trans_runtime_check (true, false, tmp, &block, &loc, msg, ! fold_convert (long_integer_type_node, temp), ! fold_convert (long_integer_type_node, stride2)); ! gfc_free (msg); } } diff -Nrcpad gcc-4.5.0/gcc/fortran/trans-decl.c gcc-4.5.1/gcc/fortran/trans-decl.c *** gcc-4.5.0/gcc/fortran/trans-decl.c Sat Mar 20 16:01:17 2010 --- gcc-4.5.1/gcc/fortran/trans-decl.c Sat Apr 24 12:29:23 2010 *************** gfc_create_module_variable (gfc_symbol * *** 3447,3453 **** tree length; length = sym->ts.u.cl->backend_decl; ! if (!INTEGER_CST_P (length)) { pushdecl (length); rest_of_decl_compilation (length, 1, 0); --- 3447,3454 ---- tree length; length = sym->ts.u.cl->backend_decl; ! gcc_assert (length || sym->attr.proc_pointer); ! if (length && !INTEGER_CST_P (length)) { pushdecl (length); rest_of_decl_compilation (length, 1, 0); diff -Nrcpad gcc-4.5.0/gcc/fortran/trans-expr.c gcc-4.5.1/gcc/fortran/trans-expr.c *** gcc-4.5.0/gcc/fortran/trans-expr.c Thu Mar 18 21:23:35 2010 --- gcc-4.5.1/gcc/fortran/trans-expr.c Sun Jul 11 16:06:53 2010 *************** gfc_conv_expr (gfc_se * se, gfc_expr * e *** 4531,4536 **** --- 4531,4538 ---- /* Substitute a scalar expression evaluated outside the scalarization loop. */ se->expr = se->ss->data.scalar.expr; + if (se->ss->type == GFC_SS_REFERENCE) + se->expr = gfc_build_addr_expr (NULL_TREE, se->expr); se->string_length = se->ss->string_length; gfc_advance_se_ss_chain (se); return; *************** gfc_conv_expr_reference (gfc_se * se, gf *** 4651,4659 **** if (se->ss && se->ss->expr == expr && se->ss->type == GFC_SS_REFERENCE) { ! se->expr = se->ss->data.scalar.expr; ! se->string_length = se->ss->string_length; ! gfc_advance_se_ss_chain (se); return; } --- 4653,4661 ---- if (se->ss && se->ss->expr == expr && se->ss->type == GFC_SS_REFERENCE) { ! /* Returns a reference to the scalar evaluated outside the loop ! for this case. */ ! gfc_conv_expr (se, expr); return; } *************** gfc_trans_scalar_assign (gfc_se * lse, g *** 4998,5038 **** } ! /* Try to translate array(:) = func (...), where func is a transformational ! array function, without using a temporary. Returns NULL is this isn't the ! case. */ ! static tree ! gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) { - gfc_se se; - gfc_ss *ss; gfc_ref * ref; bool seen_array_ref; bool c = false; ! gfc_component *comp = NULL; /* The caller has already checked rank>0 and expr_type == EXPR_FUNCTION. */ if (expr2->value.function.isym && !gfc_is_intrinsic_libcall (expr2)) ! return NULL; ! /* Elemental functions don't need a temporary anyway. */ if (expr2->value.function.esym != NULL && expr2->value.function.esym->attr.elemental) ! return NULL; ! /* Fail if rhs is not FULL or a contiguous section. */ if (expr1->ref && !(gfc_full_array_ref_p (expr1->ref, &c) || c)) ! return NULL; ! /* Fail if EXPR1 can't be expressed as a descriptor. */ if (gfc_ref_needs_temporary_p (expr1->ref)) ! return NULL; /* Functions returning pointers need temporaries. */ if (expr2->symtree->n.sym->attr.pointer || expr2->symtree->n.sym->attr.allocatable) ! return NULL; /* Character array functions need temporaries unless the character lengths are the same. */ --- 5000,5039 ---- } ! /* There are quite a lot of restrictions on the optimisation in using an ! array function assign without a temporary. */ ! static bool ! arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2) { gfc_ref * ref; bool seen_array_ref; bool c = false; ! gfc_symbol *sym = expr1->symtree->n.sym; /* The caller has already checked rank>0 and expr_type == EXPR_FUNCTION. */ if (expr2->value.function.isym && !gfc_is_intrinsic_libcall (expr2)) ! return true; ! /* Elemental functions are scalarized so that they don't need a ! temporary in gfc_trans_assignment_1, so return a true. Otherwise, ! they would need special treatment in gfc_trans_arrayfunc_assign. */ if (expr2->value.function.esym != NULL && expr2->value.function.esym->attr.elemental) ! return true; ! /* Need a temporary if rhs is not FULL or a contiguous section. */ if (expr1->ref && !(gfc_full_array_ref_p (expr1->ref, &c) || c)) ! return true; ! /* Need a temporary if EXPR1 can't be expressed as a descriptor. */ if (gfc_ref_needs_temporary_p (expr1->ref)) ! return true; /* Functions returning pointers need temporaries. */ if (expr2->symtree->n.sym->attr.pointer || expr2->symtree->n.sym->attr.allocatable) ! return true; /* Character array functions need temporaries unless the character lengths are the same. */ *************** gfc_trans_arrayfunc_assign (gfc_expr * e *** 5040,5054 **** { if (expr1->ts.u.cl->length == NULL || expr1->ts.u.cl->length->expr_type != EXPR_CONSTANT) ! return NULL; if (expr2->ts.u.cl->length == NULL || expr2->ts.u.cl->length->expr_type != EXPR_CONSTANT) ! return NULL; if (mpz_cmp (expr1->ts.u.cl->length->value.integer, expr2->ts.u.cl->length->value.integer) != 0) ! return NULL; } /* Check that no LHS component references appear during an array --- 5041,5055 ---- { if (expr1->ts.u.cl->length == NULL || expr1->ts.u.cl->length->expr_type != EXPR_CONSTANT) ! return true; if (expr2->ts.u.cl->length == NULL || expr2->ts.u.cl->length->expr_type != EXPR_CONSTANT) ! return true; if (mpz_cmp (expr1->ts.u.cl->length->value.integer, expr2->ts.u.cl->length->value.integer) != 0) ! return true; } /* Check that no LHS component references appear during an array *************** gfc_trans_arrayfunc_assign (gfc_expr * e *** 5062,5068 **** if (ref->type == REF_ARRAY) seen_array_ref= true; else if (ref->type == REF_COMPONENT && seen_array_ref) ! return NULL; } /* Check for a dependency. */ --- 5063,5069 ---- if (ref->type == REF_ARRAY) seen_array_ref= true; else if (ref->type == REF_COMPONENT && seen_array_ref) ! return true; } /* Check for a dependency. */ *************** gfc_trans_arrayfunc_assign (gfc_expr * e *** 5070,5075 **** --- 5071,5137 ---- expr2->value.function.esym, expr2->value.function.actual, NOT_ELEMENTAL)) + return true; + + /* If we have reached here with an intrinsic function, we do not + need a temporary. */ + if (expr2->value.function.isym) + return false; + + /* If the LHS is a dummy, we need a temporary if it is not + INTENT(OUT). */ + if (sym->attr.dummy && sym->attr.intent != INTENT_OUT) + return true; + + /* A PURE function can unconditionally be called without a temporary. */ + if (expr2->value.function.esym != NULL + && expr2->value.function.esym->attr.pure) + return false; + + /* TODO a function that could correctly be declared PURE but is not + could do with returning false as well. */ + + if (!sym->attr.use_assoc + && !sym->attr.in_common + && !sym->attr.pointer + && !sym->attr.target + && expr2->value.function.esym) + { + /* A temporary is not needed if the function is not contained and + the variable is local or host associated and not a pointer or + a target. */ + if (!expr2->value.function.esym->attr.contained) + return false; + + /* A temporary is not needed if the lhs has never been host + associated and the procedure is contained. */ + else if (!sym->attr.host_assoc) + return false; + + /* A temporary is not needed if the variable is local and not + a pointer, a target or a result. */ + if (sym->ns->parent + && expr2->value.function.esym->ns == sym->ns->parent) + return false; + } + + /* Default to temporary use. */ + return true; + } + + + /* Try to translate array(:) = func (...), where func is a transformational + array function, without using a temporary. Returns NULL if this isn't the + case. */ + + static tree + gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) + { + gfc_se se; + gfc_ss *ss; + gfc_component *comp = NULL; + + if (arrayfunc_assign_needs_temporary (expr1, expr2)) return NULL; /* The frontend doesn't seem to bother filling in expr->symtree for intrinsic diff -Nrcpad gcc-4.5.0/gcc/fortran/trans-openmp.c gcc-4.5.1/gcc/fortran/trans-openmp.c *** gcc-4.5.0/gcc/fortran/trans-openmp.c Sat Nov 28 12:13:21 2009 --- gcc-4.5.1/gcc/fortran/trans-openmp.c Tue Jun 15 12:17:16 2010 *************** gfc_omp_privatize_by_reference (const_tr *** 57,63 **** if (GFC_POINTER_TYPE_P (type)) return false; ! if (!DECL_ARTIFICIAL (decl)) return true; /* Some arrays are expanded as DECL_ARTIFICIAL pointers --- 57,64 ---- if (GFC_POINTER_TYPE_P (type)) return false; ! if (!DECL_ARTIFICIAL (decl) ! && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE) return true; /* Some arrays are expanded as DECL_ARTIFICIAL pointers *************** gfc_omp_privatize_by_reference (const_tr *** 75,81 **** enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree decl) { ! if (DECL_ARTIFICIAL (decl) && ! GFC_DECL_RESULT (decl)) return OMP_CLAUSE_DEFAULT_SHARED; /* Cray pointees shouldn't be listed in any clauses and should be --- 76,85 ---- enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree decl) { ! if (DECL_ARTIFICIAL (decl) ! && ! GFC_DECL_RESULT (decl) ! && ! (DECL_LANG_SPECIFIC (decl) ! && GFC_DECL_SAVED_DESCRIPTOR (decl))) return OMP_CLAUSE_DEFAULT_SHARED; /* Cray pointees shouldn't be listed in any clauses and should be *************** gfc_omp_predetermined_sharing (tree decl *** 96,101 **** --- 100,114 ---- == NULL) return OMP_CLAUSE_DEFAULT_SHARED; + /* Dummy procedures aren't considered variables by OpenMP, thus are + disallowed in OpenMP clauses. They are represented as PARM_DECLs + in the middle-end, so return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE here + to avoid complaining about their uses with default(none). */ + if (TREE_CODE (decl) == PARM_DECL + && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == FUNCTION_TYPE) + return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE; + /* COMMON and EQUIVALENCE decls are shared. They are only referenced through DECL_VALUE_EXPR of the variables contained in them. If those are privatized, they will not be *************** gfc_omp_predetermined_sharing (tree decl *** 109,114 **** --- 122,140 ---- return OMP_CLAUSE_DEFAULT_UNSPECIFIED; } + /* Return decl that should be used when reporting DEFAULT(NONE) + diagnostics. */ + + tree + gfc_omp_report_decl (tree decl) + { + if (DECL_ARTIFICIAL (decl) + && DECL_LANG_SPECIFIC (decl) + && GFC_DECL_SAVED_DESCRIPTOR (decl)) + return GFC_DECL_SAVED_DESCRIPTOR (decl); + + return decl; + } /* Return true if DECL in private clause needs OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause. */ diff -Nrcpad gcc-4.5.0/gcc/fortran/trans-types.c gcc-4.5.1/gcc/fortran/trans-types.c *** gcc-4.5.0/gcc/fortran/trans-types.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/trans-types.c Thu May 6 09:26:16 2010 *************** gfc_sym_type (gfc_symbol * sym) *** 1793,1798 **** --- 1793,1801 ---- restricted); byref = 0; } + + if (sym->attr.cray_pointee) + GFC_POINTER_TYPE_P (type) = 1; } else { *************** gfc_sym_type (gfc_symbol * sym) *** 1808,1814 **** { if (sym->attr.allocatable || sym->attr.pointer) type = gfc_build_pointer_type (sym, type); ! if (sym->attr.pointer) GFC_POINTER_TYPE_P (type) = 1; } --- 1811,1817 ---- { if (sym->attr.allocatable || sym->attr.pointer) type = gfc_build_pointer_type (sym, type); ! if (sym->attr.pointer || sym->attr.cray_pointee) GFC_POINTER_TYPE_P (type) = 1; } diff -Nrcpad gcc-4.5.0/gcc/fortran/trans.c gcc-4.5.1/gcc/fortran/trans.c *** gcc-4.5.0/gcc/fortran/trans.c Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/trans.c Sat Apr 17 22:22:02 2010 *************** along with GCC; see the file COPYING3. *** 47,53 **** static gfc_file *gfc_current_backend_file; - const char gfc_msg_bounds[] = N_("Array bound mismatch"); const char gfc_msg_fault[] = N_("Array reference out of bounds"); const char gfc_msg_wrong_return[] = N_("Incorrect function return value"); --- 47,52 ---- diff -Nrcpad gcc-4.5.0/gcc/fortran/trans.h gcc-4.5.1/gcc/fortran/trans.h *** gcc-4.5.0/gcc/fortran/trans.h Thu Apr 1 18:06:05 2010 --- gcc-4.5.1/gcc/fortran/trans.h Sun Jun 27 16:14:55 2010 *************** typedef enum *** 126,133 **** scalarization loop. */ GFC_SS_SCALAR, ! /* Like GFC_SS_SCALAR except it evaluates a pointer to the expression. ! Used for elemental function parameters. */ GFC_SS_REFERENCE, /* An array section. Scalarization indices will be substituted during --- 126,134 ---- scalarization loop. */ GFC_SS_SCALAR, ! /* Like GFC_SS_SCALAR it evaluates the expression outside the ! loop. Is always evaluated as a reference to the temporary. ! Used for elemental function arguments. */ GFC_SS_REFERENCE, /* An array section. Scalarization indices will be substituted during *************** bool gfc_get_array_descr_info (const_tre *** 518,523 **** --- 519,525 ---- /* In trans-openmp.c */ bool gfc_omp_privatize_by_reference (const_tree); enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree); + tree gfc_omp_report_decl (tree); tree gfc_omp_clause_default_ctor (tree, tree, tree); tree gfc_omp_clause_copy_ctor (tree, tree, tree); tree gfc_omp_clause_assign_op (tree, tree, tree); *************** void gfc_apply_interface_mapping (gfc_in *** 771,777 **** /* Standard error messages used in all the trans-*.c files. */ - extern const char gfc_msg_bounds[]; extern const char gfc_msg_fault[]; extern const char gfc_msg_wrong_return[]; --- 773,778 ---- diff -Nrcpad gcc-4.5.0/libgfortran/ChangeLog gcc-4.5.1/libgfortran/ChangeLog *** gcc-4.5.0/libgfortran/ChangeLog Wed Apr 14 09:19:05 2010 --- gcc-4.5.1/libgfortran/ChangeLog Sat Jul 31 09:23:21 2010 *************** *** 1,3 **** --- 1,19 ---- + 2010-07-31 Release Manager + + * GCC 4.5.1 released. + + 2010-07-14 Rainer Orth + + Backport from mainline: + 2010-07-12 Rainer Orth + + * config/fpu-387.h [__sun__ && __svr4__] Include , + . + (sigill_caught): New. + (sigill_hdlr): New function + (has_sse) [__sun__ && __svr4__]: Check if SSE instruction causes + SIGILL. + 2010-04-14 Release Manager * GCC 4.5.0 released. diff -Nrcpad gcc-4.5.0/libgfortran/config/fpu-387.h gcc-4.5.1/libgfortran/config/fpu-387.h *** gcc-4.5.0/libgfortran/config/fpu-387.h Thu Apr 9 15:00:19 2009 --- gcc-4.5.1/libgfortran/config/fpu-387.h Wed Jul 14 08:41:46 2010 *************** *** 1,5 **** /* FPU-related code for x86 and x86_64 processors. ! Copyright 2005, 2007, 2009 Free Software Foundation, Inc. Contributed by Francois-Xavier Coudert This file is part of the GNU Fortran 95 runtime library (libgfortran). --- 1,5 ---- /* FPU-related code for x86 and x86_64 processors. ! Copyright 2005, 2007, 2009, 2010 Free Software Foundation, Inc. Contributed by Francois-Xavier Coudert This file is part of the GNU Fortran 95 runtime library (libgfortran). *************** see the files COPYING3 and COPYING.RUNTI *** 27,32 **** --- 27,52 ---- #include "cpuid.h" #endif + #if defined(__sun__) && defined(__svr4__) + #include + #include + + static volatile sig_atomic_t sigill_caught; + + static void + sigill_hdlr (int sig __attribute((unused)), + siginfo_t *sip __attribute__((unused)), + ucontext_t *ucp) + { + sigill_caught = 1; + /* Set PC to the instruction after the faulting one to skip over it, + otherwise we enter an infinite loop. 4 is the size of the stmxcsr + instruction. */ + ucp->uc_mcontext.gregs[EIP] += 4; + setcontext (ucp); + } + #endif + static int has_sse (void) { *************** has_sse (void) *** 36,41 **** --- 56,86 ---- if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; + #if defined(__sun__) && defined(__svr4__) + /* Solaris 2 before Solaris 9 4/04 cannot execute SSE instructions even + if the CPU supports them. Programs receive SIGILL instead, so check + for that at runtime. */ + + if (edx & bit_SSE) + { + struct sigaction act, oact; + unsigned int cw_sse; + + act.sa_handler = sigill_hdlr; + sigemptyset (&act.sa_mask); + /* Need to set SA_SIGINFO so a ucontext_t * is passed to the handler. */ + act.sa_flags = SA_SIGINFO; + sigaction (SIGILL, &act, &oact); + + asm volatile ("stmxcsr %0" : "=m" (cw_sse)); + + sigaction (SIGILL, &oact, NULL); + + if (sigill_caught) + return 0; + } + #endif /* __sun__ && __svr4__ */ + return edx & bit_SSE; #else return 1;