2006-03-22 Thomas Koenig <Thomas.Koenig@onlien.de>
[official-gcc.git] / gcc / fortran / ChangeLog
blobda2cc08106245711a560f047e2594888b77f584f
1 2006-03-22  Thomas Koenig  <Thomas.Koenig@online.de>
3         PR fortran/19303
4         * gfortran.h (gfc_option_t):  Add record_marker.
5         * lang.opt:  Add -frecord-marker=4 and -frecord-marker=8.
6         * trans-decl.c:  Add gfor_fndecl_set_record_marker.
7         (gfc_build_builtin_function_decls): Set
8         gfor_fndecl_set_record_marker.
9         (gfc_generate_function_code):  If we are in the main program
10         and -frecord-marker was provided, call set_record_marker.
11         * options.c (gfc_handle_option):  Add handling for
12         -frecord-marker=4 and -frecord-marker=8.
13         * invoke.texi:  Document -frecord-marker.
15 2006-03-22  Paul Thomas  <pault@gcc.gnu.org>
17         PR fortran/17298
18         * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): New
19         function to implement array valued TRANSFER intrinsic.
20         (gfc_conv_intrinsic_function): Call the new function if TRANSFER
21         and non-null se->ss.
22         (gfc_walk_intrinsic_function): Treat TRANSFER as one of the
23         special cases by calling gfc_walk_intrinsic_libfunc directly.
25 2006-03-21  Toon Moene  <toon@moene.indiv.nluug.nl>
27         * options.c (gfc_init_options): Initialize
28         flag_argument_noalias to 3.
30 2006-03-20  Thomas Koenig  <Thomas.Koenig@online.de>
32         PR fortran/20935
33         * iresolve.c (gfc_resolve_maxloc):   If mask is scalar,
34         prefix the function name with an "s".  If the mask is scalar
35         or if its kind is smaller than gfc_default_logical_kind,
36         coerce it to default kind.
37         (gfc_resolve_maxval):  Likewise.
38         (gfc_resolve_minloc):  Likewise.
39         (gfc_resolve_minval):  Likewise.
40         (gfc_resolve_product):  Likewise.
41         (gfc_resolve_sum):  Likewise.
43 2006-03-19  Paul Thomas  <pault@gcc.gnu.org>
45         PR fortran/26741
46         *expr.c (external_spec_function): Permit elemental functions.
48         PR fortran/26716
49         *interface.c (compare_actual_formal): Detect call for procedure
50         usage and require rank checking, in this case, for assumed shape
51         and deferred shape arrays.
52         (gfc_procedure_use): Revert to pre-PR25070 call to
53         compare_actual_formal that does not require rank checking..
55 2006-03-16  Roger Sayle  <roger@eyesopen.com>
57         * gfortran.h (gfc_equiv_info): Add length field.
58         * trans-common.c (copy_equiv_list_to_ns): Set the length field.
59         * dependency.c (gfc_are_equivalenced_arrays): Use both the offset
60         and length fields to determine whether the two equivalenced symbols
61         overlap in memory.
63 2006-03-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
65         PR fortran/19101
66         * gfortran.h: Add warn_ampersand.
67         * invoke.texi: Add documentation for new option.
68         * lang.opt: Add Wampersand.
69         * options.c (gfc_init_options): Initialize warn_ampersand.
70         (gfc_post_options): Set the warn if pedantic.
71         (set_Wall): Set warn_ampersand.
72         (gfc_handle_option: Add Wampersand for itself, -std=f95, and -std=f2003.
73         * scanner.c (gfc_next_char_literal): Add test for missing '&' in
74         continued character constant and give warning if missing.
76 2006-03-14  Steven G. Kargl  <kargls@comcast.net>
78         PR 18537
79         * gfortran.h: Wrap Copyright line.
80         (gfc_option_t): add warn_tabs member.
81         * lang.opt: Update Coyright year.  Add the Wtabs.
82         * invoke.texi: Document -Wtabs.
83         * scanner.c (gfc_gobble_whitespace): Use warn_tabs.  Add linenum to
84         suppress multiple warnings.
85         (load_line): Use warn_tabs.  Add linenum, current_line, seen_comment
86         to suppress multiple warnings.
87         * options.c (gfc_init_options): Initialize warn_tabs.
88         (set_Wall): set warn_tabs for -Wall.
89         (gfc_post_options): Adjust flag_tabs depending on -pedantic.
90         (gfc_handle_option):  Process command-line option -W[no-]tabs
92 2006-03-13  Paul Thomas  <pault@gcc.gnu.org>
94         PR fortran/25378
95         * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Set the initial position to zero and
96         modify the condition for updating it, to implement the F2003 requirement for all(mask)
97         is false.
99 2006-03-13  Jakub Jelinek  <jakub@redhat.com>
101         * trans-openmp.c (gfc_trans_omp_variable): Handle references
102         to parent result.
103         * trans-expr.c (gfc_conv_variable): Remove useless setting
104         of parent_flag, formatting.
106         * trans-decl.c (gfc_get_fake_result_decl): Re-add setting of
107         GFC_DECL_RESULT flag.
109 2003-03-11  Roger Sayle  <roger@eyesopen.com>
111         * dependency.c (gfc_dep_compare_expr) <EXPR_OP>: Allow unary and
112         binary operators to compare equal if their operands are equal.
113         <EXPR_FUNCTION>: Allow "constant" intrinsic conversion functions
114         to compare equal, if their operands are equal.
116 2006-03-11  Erik Edelmann  <eedelman@gcc.gnu.org>
118         * symbol.c (check_conflict): Allow allocatable function results,
119         except for elemental functions.
120         * trans-array.c (gfc_trans_allocate_temp_array): Rename to ...
121         (gfc_trans_create_temp_array): ... this, and add new argument
122         callee_alloc.
123         (gfc_trans_array_constructor, gfc_conv_loop_setup): Update call
124         to gfc_trans_allocate_temp_array.
125         * trans-array.h (gfc_trans_allocate_temp_array): Update prototype.
126         * trans-expr.c (gfc_conv_function_call): Use new arg of
127         gfc_trans_create_temp_array avoid pre-allocation of temporary
128         result variables of pointer AND allocatable functions.
129         (gfc_trans_arrayfunc_assign): Return NULL for allocatable
130         functions.
131         * resolve.c (resolve_symbol): Copy value of 'allocatable' attribute
132         from sym->result to sym.
134 2006-03-09  Erik Edelmann  <eedelman@gcc.gnu.org>
136         * trans-expr.c (gfc_add_interface_mapping): Copy 'allocatable'
137         attribute from sym to new_sym.  Call build_fold_indirect_ref()
138         for allocatable arguments.
140 2006-03-09 Paul Thomas <pault@gcc.gnu.org>
142         PR fortran/26257
143         * trans-array.c (gfc_conv_expr_descriptor): Exclude calculation of
144         the offset and data when se->data_not_needed is set.
145         * trans.h: Include the data_not_need bit in gfc_se.
146         * trans-intrinsic.c (gfc_conv_intrinsic_size): Set it for SIZE.
148 2006-03-06  Paul Thomas  <pault@gcc.gnu.org>
149             Erik Edelmann  <eedelman@gcc.gnu.org>
151         * trans-array.c (gfc_trans_dealloc_allocated): New function.
152         (gfc_trans_deferred_array): Use it, instead of inline code.
153         * trans-array.h: Prototype for gfc_trans_dealloc_allocated().
154         * trans-expr.c (gfc_conv_function_call): Deallocate allocated
155         ALLOCATABLE, INTENT(OUT) arguments upon procedure entry.
157 2006-03-06  Paul Thomas  <pault@gcc.gnu.org>
159         PR fortran/26107
160         * resolve.c (resolve_function): Add name after test for pureness.
162         PR fortran/19546
163         * trans-expr.c (gfc_conv_variable): Detect reference to parent result,
164         store current_function_decl, replace with parent, whilst calls are
165         made to gfc_get_fake_result_decl, and restore afterwards. Signal this
166         to gfc_get_fake_result_decl with a new argument, parent_flag.
167         * trans-stmt.c (gfc_trans_return): gfc_get_fake_result_decl 2nd arg
168         is set to zero.
169         * trans.h: Add parent_flag to gfc_get_fake_result_decl prototype.
170         * trans-decl.c (gfc_get_fake_result_decl): On parent_flag, being set,
171         add decl to parent function. Replace refs to current_fake_result_decl
172         with refs to this_result_decl.
173         (gfc_generate_function_code): Null parent_fake_result_decl before the
174         translation of code for contained procedures. Set parent_flag to zero
175         in call to gfc_get_fake_result_decl.
176         * trans-intrinsic.c (gfc_conv_intrinsic_len): The same.
178 2006-03-05  Steven G. Kargl  <kargls@comcast.net>
180         * simplify.c (gfc_simplify_verify):  Fix return when SET=''.
182 2006-03-05  Erik Edelmann  <eedelman@gcc.gnu.org>
184         PR fortran/16136
185         * symbol.c (conf_std): New macro.
186         (check_conflict): Use it to allow ALLOCATABLE dummy
187         arguments for F2003.
188         * trans-expr.c (gfc_conv_function_call): Pass the
189         address of the array descriptor when dummy argument is
190         ALLOCATABLE.
191         * interface.c (compare_allocatable): New function.
192         (compare_actual_formal): Use it.
193         * resolve.c (resolve_deallocate_expr,
194         resolve_allocate_expr): Check that INTENT(IN) variables
195         aren't (de)allocated.
196         * gfortran.texi (Fortran 2003 status): List ALLOCATABLE
197         dummy arguments as supported.
199 2006-03-03  Roger Sayle  <roger@eyesopen.com>
201         * dependency.c (gfc_check_element_vs_element): Revert last change.
203 2006-03-03  Roger Sayle  <roger@eyesopen.com>
205         * dependency.c (gfc_check_element_vs_element): Consider two
206         unordered scalar subscripts as (potentially) equal.
208 2006-03-03  Roger Sayle  <roger@eyesopen.com>
210         * dependency.c (gfc_check_dependency): Call gfc_dep_resolver to
211         check whether two array references have a dependency.
212         (gfc_check_element_vs_element): Assume lref and rref must be
213         REF_ARRAYs.  If gfc_dep_compare_expr returns -2, assume these
214         references could potentially overlap.
215         (gfc_dep_resolver): Whitespace and comment tweaks.  Assume a
216         dependency if the references have different depths.  Rewrite
217         final term to clarrify we only have a dependency for overlaps.
219 2006-03-03  Thomas Koenig  <Thomas.Koenig@online.de>
221         PR fortran/25031
222         * trans-array.h:  Adjust gfc_array_allocate prototype.
223         * trans-array.c (gfc_array_allocate):  Change type of
224         gfc_array_allocatate to bool.  Function returns true if
225         it operates on an array.  Change second argument to gfc_expr.
226         Find last reference in chain.
227         If the function operates on an allocatable array, emit call to
228         allocate_array() or allocate64_array().
229         * trans-stmt.c (gfc_trans_allocate):  Code to follow to last
230         reference has been moved to gfc_array_allocate.
231         * trans.h:  Add declaration for gfor_fndecl_allocate_array and
232         gfor_fndecl_allocate64_array.
233         (gfc_build_builtin_function_decls):  Add gfor_fndecl_allocate_array
234         and gfor_fndecl_allocate64_array.
236 2006-03-01  Roger Sayle  <roger@eyesopen.com>
238         * trans-stmt.c (generate_loop_for_temp_to_lhs): Add an additional
239         INVERT argument to invert the sense of the WHEREMASK argument.
240         Remove unneeded code to AND together a list of masks.
241         (generate_loop_for_rhs_to_temp): Likewise.
242         (gfc_trans_assign_need_temp): Likewise.
243         (gfc_trans_forall_1): Likewise.
244         (gfc_evaluate_where_mask): Likewise, add a new INVERT argument
245         to specify the sense of the MASK argument.
246         (gfc_trans_where_assign): Likewise.
247         (gfc_trans_where_2): Likewise.  Restructure code that decides
248         whether we need to allocate zero, one or two temporary masks.
249         If this is a top-level WHERE (i.e. the incoming MASK is NULL),
250         we only need to allocate at most one temporary mask, and can
251         invert it's sense to provide the complementary pending execution
252         mask.  Only calculate the size of the required temporary arrays
253         if we need any.
254         (gfc_trans_where): Update call to gfc_trans_where_2.
256 2006-03-01  Paul Thomas  <pault@gcc.gnu.org>
258         * iresolve.c (gfc_resolve_dot_product):  Remove any difference in
259         treatment of logical types.
260         * trans-intrinsic.c (gfc_conv_intrinsic_dot_product):  New function. 
262         PR fortran/26393
263         * trans-decl.c (gfc_get_symbol_decl): Extend condition that symbols
264         must be referenced to include unreferenced symbols in an interface
265         body. 
267         PR fortran/20938
268         * trans-array.c (gfc_conv_resolve_dependencies): Add call to
269         gfc_are_equivalenced_arrays.
270         * symbol.c (gfc_free_equiv_infos, gfc_free_equiv_lists): New
271         functions. (gfc_free_namespace): Call them.
272         * trans-common.c (copy_equiv_list_to_ns): New function.
273         (add_equivalences): Call it.
274         * gfortran.h: Add equiv_lists to gfc_namespace and define
275         gfc_equiv_list and gfc_equiv_info.
276         * dependency.c (gfc_are_equivalenced_arrays): New function.
277         (gfc_check_dependency): Call it.
278         * dependency.h: Prototype for gfc_are_equivalenced_arrays.
280 2006-03-01  Roger Sayle  <roger@eyesopen.com>
282         * dependency.c (gfc_is_same_range): Compare the stride, lower and
283         upper bounds when testing array reference ranges for equality.
284         (gfc_check_dependency): Fix indentation whitespace.
285         (gfc_check_element_vs_element): Likewise.
286         (gfc_dep_resolver): Likewise.
288 2006-02-28  Thomas Koenig  <Thomas.Koenig@online.de>
290         * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc):
291         If the mask expression exists and has rank 0, enclose the
292         generated loop in an "if (mask)".  Put the default
293         initialization into the else branch.
295 2006-02-25  Thomas Koenig  <Thomas.Koenig@online.de>
297         PR fortran/23092
298         * trans-intrinsic.c (gfc_conv_intrinsic_arith):  If the
299         mask expression exists and has rank 0, enclose the generated
300         loop in an "if (mask)".
301         * (gfc_conv_intrinsic_minmaxloc):  Likewise.
303 2006-02-24  Paul Thomas  <pault@gcc.gnu.org>
305         PR fortran/26409
306         * resolve.c (resolve_contained_functions, resolve_types,
307         gfc_resolve): Revert patch of 2006-02-19.
309 2006-02-24  Paul Thomas  <pault@gcc.gnu.org>
311         PR fortran/24519
312         * dependency.c (gfc_is_same_range): Correct typo.
313         (gfc_check_section_vs_section): Call gfc_is_same_range.
315         PR fortran/25395
316         * trans-common.c (add_equivalences): Add a new flag that is set when
317         an equivalence is seen that prevents more from being reset until the
318         start of a new traversal of the list, thus ensuring completion of
319         all the equivalences.
321 2006-02-23  Erik Edelmann  <eedelman@gcc.gnu.org>
323         * module.c (read_module): Remove redundant code lines.
325 2006-02-20 Rafael �Ávila de Esp�índola <rafael.espindola@gmail.com>
326         * Make-lang.in (FORTRAN): Remove
327         (.PHONY): Remove F95 and f95. Add fortran
329 2006-02-20  Roger Sayle  <roger@eyesopen.com>
331         * trans-stmt.c (gfc_trans_where_2): Avoid updating unused current
332         execution mask for empty WHERE/ELSEWHERE clauses.  Don't allocate
333         temporary mask arrays if they won't be used.
335 2006-02-20  Roger Sayle  <roger@eyesopen.com>
337         * trans-stmt.c (gfc_trans_where_assign): Remove code to handle
338         traversing a linked list of MASKs.  The MASK is now always a
339         single element requiring no ANDing during the assignment.
341 2006-02-19  Thomas Koenig  <Thomas.Koenig@online.de>
343         * gfortran.texi:  Document environment variables which
344         influence runtime behavior.
346 2006-02-19  H.J. Lu  <hongjiu.lu@intel.com>
348         * resolve.c (resolve_contained_functions): Call resolve_entries
349         first.
350         (resolve_types): Remove calls to resolve_entries and
351         resolve_contained_functions.
352         (gfc_resolve): Call resolve_contained_functions.
354 2006-02-19  Erik Edelmann  <eedelman@gcc.gnu.org>
356         PR fortran/26201
357         * intrinsic.c (gfc_convert_type_warn): Call
358         gfc_intrinsic_symbol() on the newly created symbol.
360 2006-02-19  Paul Thomas  <pault@gcc.gnu.org>
362         PR fortran/25054
363         * resolve.c (is_non_constant_shape_array): New function.
364         (resolve_fl_variable): Remove code for the new function and call it.
365         (resolve_fl_namelist): New function.  Add test for namelist array
366         with non-constant shape, using is_non_constant_shape_array.
367         (resolve_symbol): Remove code for resolve_fl_namelist and call it.
369         PR fortran/25089
370         * match.c (match_namelist): Increment the refs field of an accepted
371         namelist object symbol.
372         * resolve.c (resolve_fl_namelist): Test namelist objects for a conflict
373         with contained or module procedures.
375 2006-02-18  Roger Sayle  <roger@eyesopen.com>
377         * trans-stmt.c (struct temporary_list): Delete.
378         (gfc_trans_where_2): Major reorganization.  Remove no longer needed
379         TEMP argument.  Allocate and deallocate the control mask and
380         pending control mask locally.
381         (gfc_trans_forall_1): Delete TEMP local variable, and update
382         call to gfc_trans_where_2.  No need to deallocate arrays after.
383         (gfc_evaluate_where_mask): Major reorganization.  Change return
384         type to void.  Pass in parent execution mask, MASK, and two
385         already allocated mask arrays CMASK and PMASK.  On return
386         CMASK := MASK & COND, PMASK := MASK & !COND.  MASK, CMASK and
387         CMASK may all be NULL, or refer to the same temporary arrays.
388         (gfc_trans_where): Update call to gfc_trans_where_2.  We no
389         longer need a TEMP variable or to deallocate temporary arrays
390         allocated by gfc_trans_where_2.
392 2006-02-18   Danny Smith  <dannysmith@users.sourceforeg.net>
394         * gfortran.h (gfc_add_attribute): Change uint to unsigned int.
395         * symbol.c (gfc_add_attribute): Likewise for definition.
396         * resolve.c (resolve_global_procedure): Likewise for variable 'type'.
398 2006-02-17  Richard Sandiford  <richard@codesourcery.com>
400         * trans-common.c: Include rtl.h earlier.
401         * trans-decl.c: Likewise.
403 2006-02-16  Jakub Jelinek  <jakub@redhat.com>
405         PR fortran/26224
406         * parse.c (parse_omp_do, parse_omp_structured_block): Call
407         gfc_commit_symbols and gfc_warning_check.
409         * openmp.c (resolve_omp_clauses): Add a dummy case label to workaround
410         PR middle-end/26316.
412 2006-02-16  Paul Thomas  <pault@gcc.gnu.org>
414         PR fortran/24557
415         * trans-expr.c (gfc_add_interface_mapping): Use the actual argument
416         for character(*) arrays, rather than casting to the type and kind
417         parameters of the formal argument.
419 2006-02-15  Toon Moene  <toon@moene.indiv.nluug.nl>
421         PR fortran/26054
422         * options.c: Do not warn for Fortran 2003 features by default.
424 2006-02-15  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
426         * check.c: Update copyright years.
427         
428         * check.c (gfc_check_minloc_maxloc, check_reduction): Don't call
429         dim_range_check on not-present optional dim argument.
431 2006-02-15  Jakub Jelinek  <jakub@redhat.com>
433         PR libgomp/25938
434         PR libgomp/25984
435         * Make-lang.in (install-finclude-dir): New goal.
436         (fortran.install-common): Depend on install-finclude-dir.
437         * lang-specs.h: If not -nostdinc, add -I finclude.
439 2006-02-14  Thomas Koenig  <Thomas.Koenig@online.de>
441         PR fortran/25045
442         * check.c (dim_check):  Perform all checks if dim is optional.
443         (gfc_check_minloc_maxloc):  Use dim_check and dim_rank_check
444         to check dim argument.
445         (check_reduction):  Likewise.
447 2006-02-14  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
449         PR fortran/26277
450         * io.c (match_ltag): Mark label as referenced.
452 2006-02-14  Jakub Jelinek  <jakub@redhat.com>
453             Richard Henderson  <rth@redhat.com>
454             Diego Novillo  <dnovillo@redhat.com>
456         * invoke.texi: Document -fopenmp.
457         * gfortran.texi (Extensions): Document OpenMP.
459         Backport from gomp-20050608-branch
460         * trans-openmp.c: Call build_omp_clause instead of
461         make_node when creating OMP_CLAUSE_* trees.
462         (gfc_trans_omp_reduction_list): Remove argument 'code'.
463         Adjust all callers.
465         * trans.h (build4_v): Define.
466         * trans-openmp.c: Call build4_v to create OMP_PARALLEL nodes.
467         Call build3_v to create OMP_SECTIONS nodes.
469         PR fortran/25162
470         * openmp.c (gfc_match_omp_variable_list): Call gfc_set_sym_referenced
471         on all symbols added to the variable list.
473         * openmp.c (gfc_match_omp_clauses): Fix check for non-INTRINSIC
474         procedure symbol in REDUCTION.
476         * trans-openmp.c (gfc_trans_omp_array_reduction): Use gfc_add
477         for MINUS_EXPR OMP_CLAUSE_REDUCTION_CODE.
479         * trans-openmp.c (gfc_trans_omp_do): Add PBLOCK argument.  If PBLOCK
480         is non-NULL, evaluate INIT/COND/INCR and chunk size expressions in
481         that statement block.
482         (gfc_trans_omp_parallel_do): Pass non-NULL PBLOCK to gfc_trans_omp_do
483         for non-ordered non-static combined loops.
484         (gfc_trans_omp_directive): Pass NULL PBLOCK to gfc_trans_omp_do.
486         * openmp.c: Include target.h and toplev.h.
487         (gfc_match_omp_threadprivate): Emit diagnostic if target does
488         not support TLS.
489         * Make-lang.in (fortran/openmp.o): Add dependencies on
490         target.h and toplev.h.
492         * trans-decl.c (gfc_get_fake_result_decl): Set GFC_DECL_RESULT.
493         * trans-openmp.c (gfc_omp_privatize_by_reference): Make
494         DECL_ARTIFICIAL vars predetermined shared except GFC_DECL_RESULT.
495         (gfc_omp_disregard_value_expr): Handle GFC_DECL_RESULT.
496         (gfc_trans_omp_variable): New function.
497         (gfc_trans_omp_variable_list, gfc_trans_omp_reduction_list): Use it.
498         * trans.h (GFC_DECL_RESULT): Define.
500         * trans-openmp.c (gfc_omp_firstprivatize_type_sizes): New function.
501         * f95-lang.c (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
502         * trans.h (gfc_omp_firstprivatize_type_sizes): New prototype.
504         * trans-openmp.c (gfc_omp_privatize_by_reference): Return
505         true if a pointer has GFC_DECL_SAVED_DESCRIPTOR set.
506         (gfc_trans_omp_array_reduction, gfc_trans_omp_reduction_list): New
507         functions.
508         (gfc_trans_omp_clauses): Add WHERE argument.  Call
509         gfc_trans_omp_reduction_list rather than gfc_trans_omp_variable_list
510         for reductions.
511         (gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
512         gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
513         gfc_trans_omp_sections, gfc_trans_omp_single): Adjust
514         gfc_trans_omp_clauses callers.
516         * openmp.c (omp_current_do_code): New var.
517         (gfc_resolve_omp_do_blocks): New function.
518         (gfc_resolve_omp_parallel_blocks): Call it.
519         (gfc_resolve_do_iterator): Add CODE argument.  Don't propagate
520         predetermination if argument is !$omp do or !$omp parallel do
521         iteration variable.
522         * resolve.c (resolve_code): Call gfc_resolve_omp_do_blocks
523         for EXEC_OMP_DO.  Adjust gfc_resolve_do_iterator caller.
524         * fortran.h (gfc_resolve_omp_do_blocks): New prototype.
525         (gfc_resolve_do_iterator): Add CODE argument.
527         * trans.h (gfc_omp_predetermined_sharing,
528         gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
529         prototypes.
530         (GFC_DECL_COMMON_OR_EQUIV, GFC_DECL_CRAY_POINTEE): Define.
531         * trans-openmp.c (gfc_omp_predetermined_sharing,
532         gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
533         functions.
534         * trans-common.c (build_equiv_decl, build_common_decl,
535         create_common): Set GFC_DECL_COMMON_OR_EQUIV flag on the decls.
536         * trans-decl.c (gfc_finish_cray_pointee): Set GFC_DECL_CRAY_POINTEE
537         on the decl.
538         * f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_SHARING,
539         LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
540         LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE): Define.
542         * openmp.c (resolve_omp_clauses): Remove extraneous comma.
544         * symbol.c (check_conflict): Add conflict between cray_pointee and
545         threadprivate.
546         * openmp.c (gfc_match_omp_threadprivate): Fail if
547         gfc_add_threadprivate returned FAILURE.
548         (resolve_omp_clauses): Diagnose Cray pointees in SHARED,
549         {,FIRST,LAST}PRIVATE and REDUCTION clauses and Cray pointers in
550         {FIRST,LAST}PRIVATE and REDUCTION clauses.
552         * resolve.c (omp_workshare_flag): New variable.
553         (resolve_function): Diagnose use of non-ELEMENTAL user defined
554         function in WORKSHARE construct.
555         (resolve_code): Cleanup forall_save use.  Make sure omp_workshare_flag
556         is set to correct value in different contexts.
558         * openmp.c (resolve_omp_clauses): Replace %s with '%s' when printing
559         variable name.
560         (resolve_omp_atomic): Likewise.
562         PR fortran/24493
563         * scanner.c (skip_free_comments): Set at_bol at the beginning of the
564         loop, not before it.
565         (skip_fixed_comments): Handle ! comments in the middle of line here
566         as well.
567         (gfc_skip_comments): Use skip_fixed_comments for FIXED_FORM even if
568         not at BOL.
569         (gfc_next_char_literal): Fix expected canonicalized *$omp string.
571         * trans-openmp.c (gfc_trans_omp_do): Use make_node and explicit
572         initialization to build OMP_FOR instead of build.
574         * trans-decl.c (gfc_gimplify_function): Invoke
575         diagnose_omp_structured_block_errors.
577         * trans-openmp.c (gfc_trans_omp_master): Use OMP_MASTER.
578         (gfc_trans_omp_ordered): Use OMP_ORDERED.
580         * gfortran.h (gfc_resolve_do_iterator, gfc_resolve_blocks,
581         gfc_resolve_omp_parallel_blocks): New prototypes.
582         * resolve.c (resolve_blocks): Renamed to...
583         (gfc_resolve_blocks): ... this.  Remove static.
584         (gfc_resolve_forall): Adjust caller.
585         (resolve_code): Only call gfc_resolve_blocks if code->block != 0
586         and not for EXEC_OMP_PARALLEL* directives.  Call
587         gfc_resolve_omp_parallel_blocks for EXEC_OMP_PARALLEL* directives.
588         Call gfc_resolve_do_iterator if resolved successfully EXEC_DO
589         iterator.
590         * openmp.c: Include pointer-set.h.
591         (omp_current_ctx): New variable.
592         (gfc_resolve_omp_parallel_blocks, gfc_resolve_do_iterator): New
593         functions.
594         * Make-lang.in (fortran/openmp.o): Depend on pointer-set.h.
596         * openmp.c (gfc_match_omp_clauses): For max/min/iand/ior/ieor,
597         look up symbol if it exists, use its name instead and, if it is not
598         INTRINSIC, issue diagnostics.
600         * parse.c (parse_omp_do): Handle implied end do properly.
601         (parse_executable): If parse_omp_do returned ST_IMPLIED_ENDDO,
602         return it instead of continuing.
604         * trans-openmp.c (gfc_trans_omp_critical): Update for changed
605         operand numbering.
606         (gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
607         gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
608         gfc_trans_omp_sections, gfc_trans_omp_single): Likewise.
610         * trans.h (gfc_omp_privatize_by_reference): New prototype.
611         * f95-lang.c (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Redefine
612         to gfc_omp_privatize_by_reference.
613         * trans-openmp.c (gfc_omp_privatize_by_reference): New function.
615         * trans-stmt.h (gfc_trans_omp_directive): Add comment.
617         * openmp.c (gfc_match_omp_variable_list): Add ALLOW_COMMON argument.
618         Disallow COMMON matching if it is set.
619         (gfc_match_omp_clauses, gfc_match_omp_flush): Adjust all callers.
620         (resolve_omp_clauses): Show locus in error messages.  Check that
621         variable types in reduction clauses are appropriate for reduction
622         operators.
624         * resolve.c (resolve_symbol): Don't error if a threadprivate module
625         variable isn't SAVEd.
627         * trans-openmp.c (gfc_trans_omp_do): Put count into BLOCK, not BODY.
628         Fix typo in condition.  Fix DOVAR initialization.
630         * openmp.c (gfc_match_omp_clauses): Match min/iand/ior/ieor
631         rather than .min. etc.
633         * trans-openmpc.c (omp_not_yet): Remove.
634         (gfc_trans_omp_parallel_do): Keep listprivate clause on parallel.
635         Force creation of BIND_EXPR around the workshare construct.
636         (gfc_trans_omp_parallel_sections): Likewise.
637         (gfc_trans_omp_parallel_workshare): Likewise.
639         * types.def (BT_I16, BT_FN_I16_VPTR_I16,
640         BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
642         * trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_DEFAULT.
643         (gfc_trans_omp_code): New function.
644         (gfc_trans_omp_do): Use it, remove omp_not_yet uses.
645         (gfc_trans_omp_parallel, gfc_trans_omp_single): Likewise.
646         (gfc_trans_omp_sections): Likewise.  Only treat empty last section
647         specially if lastprivate clause is present.
648         * f95-lang.c (gfc_init_builtin_functions): Create BUILT_IN_TRAP
649         builtin.
651         * trans-openmp.c (gfc_trans_omp_variable_list): Update for
652         OMP_CLAUSE_DECL name change.
653         (gfc_trans_omp_do): Likewise.
655         * trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_REDUCTION
656         clauses.
657         (gfc_trans_omp_atomic): Build OMP_ATOMIC instead of expanding
658         sync builtins directly.
659         (gfc_trans_omp_single): Build OMP_SINGLE statement.
661         * trans-openmp.c (gfc_trans_add_clause): New.
662         (gfc_trans_omp_variable_list): Take a tree code and build the clause
663         node here.  Link it to the head of a list.
664         (gfc_trans_omp_clauses): Update to match.
665         (gfc_trans_omp_do): Use gfc_trans_add_clause.
667         * trans-openmp.c (gfc_trans_omp_clauses): Change second argument to
668         gfc_omp_clauses *.  Use gfc_evaluate_now instead of creating
669         temporaries by hand.
670         (gfc_trans_omp_atomic, gfc_trans_omp_critical): Use buildN_v macros.
671         (gfc_trans_omp_do): New function.
672         (gfc_trans_omp_master): Dont' check for gfc_trans_code returning NULL.
673         (gfc_trans_omp_parallel): Adjust gfc_trans_omp_clauses caller.
674         Use buildN_v macros.
675         (gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
676         gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections,
677         gfc_trans_omp_single, gfc_trans_omp_workshare): New functions.
678         (gfc_trans_omp_directive): Use them.
679         * parse.c (parse_omp_do): Allow new_st.op == EXEC_NOP.
680         * openmp.c (resolve_omp_clauses): Check for list items present
681         in multiple clauses.
682         (resolve_omp_do): Check that iteration variable is not THREADPRIVATE
683         and is not present in any clause variable lists other than PRIVATE
684         or LASTPRIVATE.
686         * gfortran.h (symbol_attribute): Add threadprivate bit.
687         (gfc_common_head): Add threadprivate member, change use_assoc
688         and saved into char to save space.
689         (gfc_add_threadprivate): New prototype.
690         * symbol.c (check_conflict): Handle threadprivate.
691         (gfc_add_threadprivate): New function.
692         (gfc_copy_attr): Copy threadprivate.
693         * trans-openmp.c (gfc_trans_omp_clauses): Avoid creating a temporary
694         if IF or NUM_THREADS is constant.  Create OMP_CLAUSE_SCHEDULE and
695         OMP_CLAUSE_ORDERED.
696         * resolve.c (resolve_symbol): Complain if a THREADPRIVATE symbol
697         outside a module and not in COMMON has is not SAVEd.
698         (resolve_equivalence): Ensure THREADPRIVATE objects don't get
699         EQUIVALENCEd.
700         * trans-common.c: Include target.h and rtl.h.
701         (build_common_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
702         * trans-decl.c: Include rtl.h.
703         (gfc_finish_var_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
704         * dump-parse-tree.c (gfc_show_attr): Handle THREADPRIVATE.
705         * Make-lang.in (fortran/trans-decl.o): Depend on $(RTL_H).
706         (fortran/trans-common.o): Depend on $(RTL_H) and $(TARGET_H).
707         * openmp.c (gfc_match_omp_variable_list): Ensure COMMON block
708         is from current namespace.
709         (gfc_match_omp_threadprivate): Rewrite.
710         (resolve_omp_clauses): Check some clause restrictions.
711         * module.c (ab_attribute): Add AB_THREADPRIVATE.
712         (attr_bits): Add THREADPRIVATE.
713         (mio_symbol_attribute, mio_symbol_attribute): Handle threadprivate.
714         (load_commons, write_common, write_blank_common): Adjust for type
715         change of saved, store/load threadprivate bit from the integer
716         as well.
718         * types.def (BT_FN_UINT_UINT): New.
719         (BT_FN_VOID_UINT_UINT): Remove.
721         * trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_barrier,
722         gfc_trans_omp_critical, gfc_trans_omp_flush, gfc_trans_omp_master,
723         gfc_trans_omp_ordered, gfc_trans_omp_parallel): New functions.
724         (gfc_trans_omp_directive): Use them.
726         * openmp.c (expr_references_sym): Add SE argument, don't look
727         into SE tree.
728         (is_conversion): New function.
729         (resolve_omp_atomic): Adjust expr_references_sym callers.  Handle
730         promoted expressions.
731         * trans-openmp.c (gfc_trans_omp_atomic): New function.
732         (gfc_trans_omp_directive): Call it.
734         * f95-lang.c (builtin_type_for_size): New function.
735         (gfc_init_builtin_functions): Initialize synchronization and
736         OpenMP builtins.
737         * types.def: New file.
738         * Make-lang.in (f95-lang.o): Depend on $(BUILTINS_DEF) and
739         fortran/types.def.
741         * trans-openmp.c: Rename GOMP_* tree codes into OMP_*.
743         * dump-parse-tree.c (show_symtree): Don't crash if ns->proc_name
744         is NULL.
746         * dump-parse-tree.c (gfc_show_namelist, gfc_show_omp_node): New
747         functions.
748         (gfc_show_code_node): Call gfc_show_omp_node for EXEC_OMP_* nodes.
750         * parse.c (parse_omp_do): Call pop_state before next_statement.
751         * openmp.c (expr_references_sym, resolve_omp_atomic, resolve_omp_do):
752         New functions.
753         (gfc_resolve_omp_directive): Call them.
754         * match.c (match_exit_cycle): Issue error if EXIT or CYCLE statement
755         leaves an OpenMP structured block or if EXIT terminates !$omp do
756         loop.
758         * Make-lang.in (F95_PARSER_OBJS): Add fortran/openmp.o.
759         (F95_OBJS): Add fortran/trans-openmp.o.
760         (fortran/trans-openmp.o): Depend on $(GFORTRAN_TRANS_DEPS).
761         * lang.opt: Add -fopenmp option.
762         * options.c (gfc_init_options): Initialize it.
763         (gfc_handle_option): Handle it.
764         * gfortran.h (ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL,
765         ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER,
766         ST_OMP_END_ORDERED, ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO,
767         ST_OMP_END_PARALLEL_SECTIONS, ST_OMP_END_PARALLEL_WORKSHARE,
768         ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, ST_OMP_END_WORKSHARE,
769         ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
770         ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
771         ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION,
772         ST_OMP_SINGLE, ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE): New
773         statement codes.
774         (OMP_LIST_PRIVATE, OMP_LIST_FIRSTPRIVATE, OMP_LIST_LASTPRIVATE,
775         OMP_LIST_COPYPRIVATE, OMP_LIST_SHARED, OMP_LIST_COPYIN,
776         OMP_LIST_PLUS, OMP_LIST_REDUCTION_FIRST, OMP_LIST_MULT,
777         OMP_LIST_SUB, OMP_LIST_AND, OMP_LIST_OR, OMP_LIST_EQV,
778         OMP_LIST_NEQV, OMP_LIST_MAX, OMP_LIST_MIN, OMP_LIST_IAND,
779         OMP_LIST_IOR, OMP_LIST_IEOR, OMP_LIST_REDUCTION_LAST, OMP_LIST_NUM):
780         New OpenMP variable list types.
781         (gfc_omp_clauses): New typedef.
782         (gfc_get_omp_clauses): Define.
783         (EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
784         EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
785         EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
786         EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
787         EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
788         EXEC_OMP_END_SINGLE): New OpenMP gfc_exec_op codes.
789         (struct gfc_code): Add omp_clauses, omp_name, omp_namelist
790         and omp_bool fields to ext union.
791         (flag_openmp): Declare.
792         (gfc_free_omp_clauses, gfc_resolve_omp_directive): New prototypes.
793         * scanner.c (openmp_flag, openmp_locus): New variables.
794         (skip_free_comments, skip_fixed_comments, gfc_next_char_literal):
795         Handle OpenMP directive lines and conditional compilation magic
796         comments.
797         * parse.h (COMP_OMP_STRUCTURED_BLOCK): New compile state.
798         * parse.c (decode_omp_directive, parse_omp_do, parse_omp_atomic,
799         parse_omp_structured_block): New functions.
800         (next_free, next_fixed): Parse OpenMP directives.
801         (case_executable, case_exec_markers, case_decl): Add ST_OMP_*
802         codes.
803         (gfc_ascii_statement): Handle ST_OMP_* codes.
804         (parse_executable): Rearrange the loop slightly, so that
805         parse_omp_do can return next_statement.
806         * match.h (gfc_match_omp_eos, gfc_match_omp_atomic,
807         gfc_match_omp_barrier, gfc_match_omp_critical, gfc_match_omp_do,
808         gfc_match_omp_flush, gfc_match_omp_master, gfc_match_omp_ordered,
809         gfc_match_omp_parallel, gfc_match_omp_parallel_do,
810         gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare,
811         gfc_match_omp_sections, gfc_match_omp_single,
812         gfc_match_omp_threadprivate, gfc_match_omp_workshare,
813         gfc_match_omp_end_nowait, gfc_match_omp_end_single): New prototypes.
814         * resolve.c (resolve_blocks): Ignore EXEC_OMP_* block directives.
815         (resolve_code): Call gfc_resolve_omp_directive on EXEC_OMP_*
816         directives.
817         * trans.c (gfc_trans_code): Call gfc_trans_omp_directive for
818         EXEC_OMP_* directives.
819         * st.c (gfc_free_statement): Handle EXEC_OMP_* statement freeing.
820         * trans-stmt.h (gfc_trans_omp_directive): New prototype.
821         * openmp.c: New file.
822         * trans-openmp.c: New file.
824 2006-02-13  Andrew Pinski  <pinskia@physics.uc.edu>
825             Jakub Jelinek  <jakub@redhat.com>
827         PR fortran/26246
828         * trans-decl.c (gfc_get_symbol_decl, gfc_get_fake_result_decl): Use
829         gfc_add_decl_to_function rather than gfc_finish_var_decl on length.
831 2006-02-13  Paul Thomas  <pault@gcc.gnu.org>
833         PR fortran/26074
834         PR fortran/25103
835         * resolve.c (resolve_symbol): Extend the requirement that module
836         arrays have constant bounds to those in the main program.  At the
837         same time simplify the array bounds, to avoiding trapping parameter
838         array references, and exclude automatic character length from main
839         and modules. Rearrange resolve_symbol and resolve_derived to put as
840         each flavor together, as much as is possible and move all specific
841         code for flavors FL_VARIABLE, FL_PROCEDURE and FL_PARAMETER into new
842         functions.
843         (resolve_fl_var_and_proc, resolve_fl_variable, resolve_fl_procedure):
844         New functions to do work of resolve_symbol.
845         (resolve_index_expr): New function that is called from resolved_symbol
846         and is extracted from resolve_charlen.
847         (resolve_charlen): Call this new function.
848         (resolve_fl_derived): Renamed resolve_derived to be consistent with
849         the naming of the new functions for the other flavours.  Change the
850         charlen checking so that the style is consistent with other similar
851         checks. Add the generation of the gfc_dt_list, removed from resolve_
852         symbol.
854         PR fortran/20861
855         * resolve.c (resolve_actual_arglist): Prevent internal procedures
856         from being dummy arguments.
858         PR fortran/20871
859         * resolve.c (resolve_actual_arglist): Prevent pure but non-intrinsic
860         procedures from being dummy arguments.
862         PR fortran/25083
863         * resolve.c (check_data_variable): Add test that data variable is in
864         COMMON.
866         PR fortran/25088
867         * resolve.c (resolve_call): Add test that the subroutine does not
868         have a type.
870 2006-02-12  Erik Edelmann  <eedelman@gcc.gnu.org>
872         PR fortran/25806
873         * trans-array.c (gfc_trans_allocate_array_storage): New argument
874         dealloc; free the temporary only if dealloc is true.
875         (gfc_trans_allocate_temp_array): New argument bool dealloc, to be
876         passed onwards to gfc_trans_allocate_array_storage.
877         (gfc_trans_array_constructor, gfc_conv_loop_setup): Update call to
878         gfc_trans_allocate_temp_array.
879         * trans-array.h (gfc_trans_allocate_temp_array): Update function
880         prototype.
881         * trans-expr.c (gfc_conv_function_call): Set new argument 'dealloc'
882         to gfc_trans_allocate_temp_array to false in case of functions
883         returning pointers.
884         (gfc_trans_arrayfunc_assign): Return NULL for functions returning
885         pointers.
887 2006-02-10  Steven G. Kargl  <kargls@comcast.net>
889         PR fortran/20858
890         *decl.c (variable_decl): Improve error message.  Remove initialization
891         typespec.  Wrap long line.
892         *expr.c (gfc_check_pointer_assign): Permit checking of type, kind type,
893         and rank.
894         *simplify.c (gfc_simplify_null): Ensure type, kind type, and rank
895         are set.
898 2006-02-10  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
900         PR fortran/14771
901         * arith.c (eval_intrinsic): Accept INTRINSIC_PARENTHESES.
902         * expr.c (check_intrinsic_op): Likewise.
903         * module.c (mio_expr): Likewise.
905 2006-02-09  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
907         * dump-parse-tree.c: Update copyright years.
908         * matchexp.c: Likewise.
909         * module.c: Likewise.
911         PR fortran/14771
912         * gfortran.h (gfc_intrinsic_op): Add INTRINSIC_PARENTHESES.
913         * dump-parse-tree (gfc_show_expr): Handle INTRINSIC_PARENTHESES.
914         * expr.c (simplify_intrinsic_op): Treat INTRINSIC_PARENTHESES as
915         if it were INTRINSIC_UPLUS.
916         * resolve.c (resolve_operator): Handle INTRINSIC_PARENTHESES.
917         * match.c (intrinsic_operators): Add INTRINSIC_PARENTHESES.
918         * matchexp.c (match_primary): Record parentheses surrounding
919         numeric expressions.
920         * module.c (intrinsics): Add INTRINSIC_PARENTHESES for module
921         dumping.
922         * trans-expr.c (gfc_conv_expr_op): Handle INTRINSIC_PARENTHESES.
924 2006-02-09  Paul Thomas  <pault@gcc.gnu.org>
926         PR fortran/26038
927         * trans-stmt.c (gfc_trans_allocate): Provide assumed character length
928         scalar with missing backend_decl for the hidden dummy charlen.
930         PR fortran/25059
931         * interface.c (gfc_extend_assign): Remove detection of non-PURE
932         subroutine in assignment interface, with gfc_error, and put it in
933         * resolve.c (resolve_code).
935         PR fortran/25070
936         * interface.c (gfc_procedure_use): Flag rank checking for non-
937         elemental, contained or interface procedures in call to
938         (compare_actual_formal), where ranks are checked for assumed
939         shape arrays..
941 2006-02-08  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
943         PR libfortran/25425
944         * trans-decl.c (gfc_generate_function_code): Add new argument,
945         pedantic, to set_std call.
947 2006-02-06  Thomas Koenig  <Thomas.Koenig@online.de>
949         PR libfortran/23815
950         * gfortran.texi: Document the GFORTRAN_CONVERT_UNIT environment
951         variable.
952         * invoke.texi:  Mention the "Runtime" chapter.
953         Document the -fconvert= option.
954         * gfortran.h:  Add options_convert.
955         * lang.opt:  Add fconvert=little-endian, fconvert=big-endian,
956         fconvert=native and fconvert=swap.
957         * trans-decl.c (top level):  Add gfor_fndecl_set_convert.
958         (gfc_build_builtin_function_decls):  Set gfor_fndecl_set_convert.
959         (gfc_generate_function_code):  If -fconvert was specified,
960         and this is the main program, add a call to set_convert().
961         * options.c:  Handle the -fconvert options.
963 2006-02-06  Roger Sayle  <roger@eyesopen.com>
965         * trans-stmt.c (gfc_evaluate_where_mask): Allow the NMASK argument
966         to be NULL to indicate that the not mask isn't required.
967         (gfc_trans_where_2): Remove PMASK argument.  Avoid calculating the
968         pending mask for the last clause of a WHERE chain.  Update recursive
969         call.
970         (gfc_trans_forall_1): Update call to gfc_trans_where_2.
971         (gfc_trans_where): Likewise.
973 2006-02-06  Jakub Jelinek  <jakub@redhat.com>
975         Backport from gomp-20050608-branch
976         * trans-decl.c (create_function_arglist): Handle dummy functions.
978         * trans-decl.c (gfc_get_symbol_decl): Revert explicit setting of
979         TYPE_SIZE_UNIT.
980         (gfc_trans_vla_type_sizes): Also "gimplify"
981         GFC_TYPE_ARRAY_DATAPTR_TYPE for GFC_DESCRIPTOR_TYPE_P types.
982         * trans-array.c (gfc_trans_deferred_array): Call
983         gfc_trans_vla_type_sizes.
985         * trans-decl.c (saved_function_decls, saved_parent_function_decls):
986         Remove unnecessary initialization.
987         (create_function_arglist): Make sure __result has complete type.
988         (gfc_get_fake_result_decl): Change current_fake_result_decl into
989         a tree chain.  For entry master, create a separate variable
990         for each result name.  For BT_CHARACTER results, call
991         gfc_finish_var_decl on length even if it has been already created,
992         but not pushdecl'ed.
993         (gfc_trans_vla_type_sizes): For function/entry result, adjust
994         result value type, not the FUNCTION_TYPE.
995         (gfc_generate_function_code): Adjust for current_fake_result_decl
996         changes.
997         (gfc_trans_deferred_vars): Likewise.  Call gfc_trans_vla_type_sizes
998         even on result if it is assumed-length character.
1000         * trans-decl.c (gfc_trans_dummy_character): Add SYM argument.
1001         Call gfc_trans_vla_type_sizes.
1002         (gfc_trans_auto_character_variable): Call gfc_trans_vla_type_sizes.
1003         (gfc_trans_vla_one_sizepos, gfc_trans_vla_type_sizes_1,
1004         gfc_trans_vla_type_sizes): New functions.
1005         (gfc_trans_deferred_vars): Adjust gfc_trans_dummy_character
1006         callers.  Call gfc_trans_vla_type_sizes on assumed-length
1007         character parameters.
1008         * trans-array.c (gfc_trans_array_bounds,
1009         gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias): Call
1010         gfc_trans_vla_type_sizes.
1011         * trans.h (gfc_trans_vla_type_sizes): New prototype.
1013         * trans-decl.c (gfc_build_qualified_array): For non-assumed-size
1014         arrays without constant size, create also an index var for
1015         GFC_TYPE_ARRAY_SIZE (type).  If the type is incomplete, complete
1016         it as 0..size-1.
1017         (gfc_create_string_length): Don't call gfc_defer_symbol_init
1018         if just creating DECL_ARGUMENTS.
1019         (gfc_get_symbol_decl): Call gfc_finish_var_decl and
1020         gfc_defer_symbol_init even if ts.cl->backend_decl is already
1021         set to a VAR_DECL that doesn't have DECL_CONTEXT yet.
1022         (create_function_arglist): Rework, so that hidden length
1023         arguments for CHARACTER parameters are created together with
1024         the parameters.  Resolve ts.cl->backend_decl for CHARACTER
1025         parameters.  If the argument is a non-constant length array
1026         or CHARACTER, ensure PARM_DECL has different type than
1027         its DECL_ARG_TYPE.
1028         (generate_local_decl): Call gfc_get_symbol_decl even
1029         for non-referenced non-constant length CHARACTER parameters
1030         after optionally issuing warnings.
1031         * trans-array.c (gfc_trans_array_bounds): Set last stride
1032         to GFC_TYPE_ARRAY_SIZE (type) to initialize it as well.
1033         (gfc_trans_dummy_array_bias): Initialize GFC_TYPE_ARRAY_SIZE (type)
1034         variable as well.
1036         * trans-expr.c (gfc_conv_expr_val): Fix comment typo.
1038         * trans-stmt.c (gfc_trans_simple_do): Fix comment.
1040 2006-02-04  Roger Sayle  <roger@eyesopen.com>
1042         * dependency.c (gfc_check_dependency): Remove unused vars and nvars
1043         arguments.  Replace with an "identical" argument.  A full array
1044         reference to the same symbol is a dependency if identical is true.
1045         * dependency.h (gfc_check_dependency): Update prototype.
1046         * trans-array.h (gfc_check_dependency): Delete duplicate prototype.
1047         * trans-stmt.c: #include dependency.h for gfc_check_dependency.
1048         (gfc_trans_forall_1): Update calls to gfc_check_dependency.
1049         (gfc_trans_where_2): Likewise.  Remove unneeded variables.
1050         (gfc_trans_where_3): New function for simple non-dependent WHEREs.
1051         (gfc_trans_where): Call gfc_trans_where_3 to translate simple
1052         F90-style WHERE statements without internal dependencies.
1053         * Make-lang.in (trans-stmt.o): Depend upon dependency.h.
1055 2006-02-05  H.J. Lu  <hongjiu.lu@intel.com>
1057         PR fortran/26041
1058         PR fortran/26064
1059         * resolve.c (resolve_types): New function.
1060         (resolve_codes): Likewise.
1061         (gfc_resolve): Use them.
1063 2006-02-05  Roger Sayle  <roger@eyesopen.com>
1065         * trans-stmt.c (gfc_evaluate_where_mask): Use LOGICAL*1 for WHERE
1066         masks instead of LOGICAL*4.
1068 2006-02-05  Jakub Jelinek  <jakub@redhat.com>
1070         * resolve.c (resolve_symbol): Initialize constructor_expr to NULL.
1072 2006-02-04  Thomas Koenig  <Thomas.Koenig@online.de>
1074         PR fortran/25075
1075         check.c (identical_dimen_shape):  New function.
1076         (check_dot_product):  Use identical_dimen_shape() to check sizes
1077         for dot_product.
1078         (gfc_check_matmul):  Likewise.
1079         (gfc_check_merge):  Check conformance between tsource and fsource
1080         and between tsource and mask.
1081         (gfc_check_pack):  Check conformance between array and mask.
1083 2006-02-03  Steven G. Kargl  <kargls@comcast>
1084             Paul Thomas  <pault@gcc.gnu.org>
1086         PR fortran/20845
1087         * resolve.c (resolve_symbol): Default initialization of derived type
1088         component reguires the SAVE attribute.
1090 2006-02-02  Steven G. Kargl  <kargls@comcast>
1092         PR fortran/24958
1093         match.c (gfc_match_nullify):  Free the list from head not tail.
1095         PR fortran/25072
1096         * match.c (match_forall_header): Fix internal error caused by bogus
1097         gfc_epxr pointers.
1100 2006-01-31  Thomas Koenig  <Thomas.Koenig@online.de>
1102         PR fortran/26039
1103         expr.c (gfc_check_conformance):  Reorder error message
1104         to avoid plural.
1105         check.c(gfc_check_minloc_maxloc):  Call gfc_check_conformance
1106         for checking arguments array and mask.
1107         (check_reduction):  Likewise.
1109 2006-01-30  Erik Edelmann  <eedelman@gcc.gnu.org>
1111         PR fortran/24266
1112         * trans-io.c (set_internal_unit): Check the rank of the
1113         expression node itself instead of its symbol.
1115 2006-01-29  Paul Thomas  <pault@gcc.gnu.org>
1117         PR fortran/18578
1118         PR fortran/18579
1119         PR fortran/20857
1120         PR fortran/20885
1121         * interface.c (compare_actual_formal): Error for INTENT(OUT or INOUT)
1122         if actual argument is not a variable.
1124 2006-01-28  Paul Thomas  <pault@gcc.gnu.org>
1126         PR fortran/17911
1127         * expr.c (gfc_check_assign, gfc_check_pointer_assign): Emit error if
1128         the lvalue is a use associated procedure.
1130         PR fortran/20895
1131         PR fortran/25030
1132         * expr.c (gfc_check_pointer_assign): Emit error if lvalue and rvalue
1133         character lengths are not the same.  Use gfc_dep_compare_expr for the
1134         comparison.
1135         * gfortran.h: Add prototype for gfc_dep_compare_expr.
1136         * dependency.h: Remove prototype for gfc_dep_compare_expr.
1138 2006-01-27  Paul Thomas  <pault@gcc.gnu.org>
1140         PR fortran/25964
1141         * resolve.c (resolve_function): Add GFC_ISYM_LOC to the list of
1142         generic_ids exempted from assumed size checking.
1144 2006-01-27  Jakub Jelinek  <jakub@redhat.com>
1146         PR fortran/25324
1147         * Make-lang.in (fortran/scanner.o): Depend on toplev.h.
1148         * lang.opt (fpreprocessed): New option.
1149         * scanner.c: Include toplev.h.
1150         (gfc_src_file, gfc_src_preprocessor_lines): New variables.
1151         (preprocessor_line): Unescape filename if there were any
1152         backslashes.
1153         (load_file): If initial and gfc_src_file is not NULL,
1154         use it rather than opening the file.  If gfc_src_preprocessor_lines
1155         has non-NULL elements, pass it to preprocessor_line.
1156         (unescape_filename, gfc_read_orig_filename): New functions.
1157         * gfortran.h (gfc_option_t): Add flag_preprocessed.
1158         (gfc_read_orig_filename): New prototype.
1159         * options.c (gfc_init_options): Clear flag_preprocessed.
1160         (gfc_post_options): If flag_preprocessed, call
1161         gfc_read_orig_filename.
1162         (gfc_handle_option): Handle OPT_fpreprocessed.
1163         * lang-specs.h: Pass -fpreprocessed to f951 if preprocessing
1164         sources.
1166 2006-01-27  Erik Edelmann  <eedelman@gcc.gnu.org>
1168         * symbol.c (free_old_symbol): Fix confusing comment, and add code
1169           to free old_symbol->formal.
1171 2006-01-26  Paul Thomas  <pault@gcc.gnu.org>
1173         PR fortran/25964
1174         * resolve.c (resolve_function): Exclude statement functions from
1175         global reference checking.
1177         PR fortran/25084
1178         PR fortran/20852
1179         PR fortran/25085
1180         PR fortran/25086
1181         * resolve.c (resolve_function): Declare a gfc_symbol to replace the
1182         references through the symtree to the symbol associated with the
1183         function expresion. Give error on reference to an assumed character
1184         length function is defined in an interface or an external function
1185         that is not a dummy argument.
1186         (resolve_symbol): Give error if an assumed character length function
1187         is array-valued, pointer-valued, pure or recursive. Emit warning
1188         that character(*) value functions are obsolescent in F95.
1190         PR fortran/25416
1191         * trans-expr.c (gfc_conv_function_call): The above patch to resolve.c
1192         prevents any assumed character length function call from getting here
1193         except intrinsics such as SPREAD. In this case, ensure that no
1194         segfault occurs from referencing non-existent charlen->length->
1195         expr_type and provide a backend_decl for the charlen from the charlen
1196         of the first actual argument.
1198         Cure temp name confusion.
1199         * trans-expr.c (gfc_get_interface_mapping_array): Change name of
1200         temporary from "parm" to "ifm" to avoid clash with temp coming from
1201         trans-array.c.
1203 2006-01-25  Erik Edelmann  <eedelman@gcc.gnu.org>
1205         PR fortran/25716
1206         * symbol.c (free_old_symbol): New function.
1207         (gfc_commit_symbols): Use it.
1208         (gfc_commit_symbol): New function.
1209         (gfc_use_derived): Use it.
1210         * gfortran.h: Add prototype for gfc_commit_symbol.
1211         * intrinsic.c (gfc_find_function): Search in 'conversion'
1212         if not found in 'functions'.
1213         (gfc_convert_type_warn): Add a symtree to the new
1214         expression node, and commit the new symtree->n.sym.
1215         * resolve.c (gfc_resolve_index): Make sure typespec is
1216         properly initialized.
1218 2006-01-23  Paul Thomas  <pault@gcc.gnu.org>
1220         PR fortran/25901
1221         * decl.c (get_proc_name): Replace subroutine and function attributes
1222         in "already defined" test by the formal arglist pointer being non-NULL.
1224         Fix regression in testing of admissability of attributes.
1225         * symbol.c (gfc_add_attribute): If the current_attr has non-zero
1226         intent, do not do the check for a dummy being used.
1227         * decl.c (attr_decl1): Add current_attr.intent as the third argument
1228         in the call to gfc_add_attribute.
1229         * gfortran.h: Add the third argument to the prototype for
1230         gfc_add_attribute.
1232 2006-01-21  Joseph S. Myers  <joseph@codesourcery.com>
1234         * gfortranspec.c (lang_specific_driver): Update copyright notice
1235         date.
1237 2006-01-21  Paul Thomas  <pault@gcc.gnu.org>
1239         PR fortran/25124
1240         PR fortran/25625
1241         * decl.c (get_proc_name): If there is an existing
1242         symbol in the encompassing namespace, call errors
1243         if it is a procedure of the same name or the kind
1244         field is set, indicating a type declaration.
1246         PR fortran/20881
1247         PR fortran/23308
1248         PR fortran/25538
1249         PR fortran/25710
1250         * decl.c (add_global_entry): New function to check
1251         for existing global symbol with this name and to
1252         create new one if none exists.
1253         (gfc_match_entry): Call add_global_entry before
1254         matching argument lists for subroutine and function
1255         entries.
1256         * gfortran.h: Prototype for existing function,
1257         global_used.
1258         * resolve.c (resolve_global_procedure): New function
1259         to check global symbols for procedures.
1260         (resolve_call, resolve_function): Calls to this
1261         new function for non-contained and non-module
1262         procedures.
1263         * match.c (match_common): Add check for existing
1264         global symbol, creat one if none exists and emit
1265         error if there is a clash.
1266         * parse.c (global_used): Remove static and use the
1267         gsymbol name rather than the new_block name, so that
1268         the function can be called from resolve.c.
1269         (parse_block_data, parse_module, add_global_procedure):
1270         Improve checks for existing gsymbols.  Emit error if
1271         already defined or if references were to another type.
1272         Set defined flag.
1274         PR fortran/PR24276
1275         * trans-expr.c (gfc_conv_aliased_arg): New function called by 
1276         gfc_conv_function_call that coverts an expression for an aliased
1277         component reference to a derived type array into a temporary array
1278         of the same type as the component.  The temporary is passed as an
1279         actual argument for the procedure call and is copied back to the
1280         derived type after the call.
1281         (is_aliased_array): New function that detects an array reference
1282         that is followed by a component reference.
1283         (gfc_conv_function_call): Detect an aliased actual argument with
1284         is_aliased_array and convert it to a temporary and back again
1285         using gfc_conv_aliased_arg.
1287 2006-01-19  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
1289         * gfortranspec.c: Update copyright years.
1290         * trans.c: Likewise.
1291         * trans-array.c: Likewise.
1292         * trans-array.h: Likewise.
1293         * trans-decl.c: Likewise.
1294         * trans-stmt.c: Likewise.
1295         * trans-stmt.h: Likewise.
1296         * trans-types.c: Likewise.
1298 2006-01-18  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
1300         PR fortran/18540
1301         PR fortran/18937
1302         * gfortran.h (BBT_HEADER): Move definition up.
1303         (gfc_st_label): Add BBT_HEADER, remove 'prev' and 'next'.
1304         * io.c (format_asterisk): Adapt initializer.
1305         * resolve.c (resolve_branch): Allow FORTRAN 66 cross-block GOTOs
1306         as extension.
1307         (warn_unused_label): Take gfc_st_label label as argument, adapt to
1308         new data structure.
1309         (gfc_resolve): Adapt call to warn_unused_label.
1310         * symbol.c (compare_st_labels): New function.
1311         (gfc_free_st_label, free_st_labels, gfc_get_st_label): Convert to
1312         using balanced binary tree.
1313         * decl.c (match_char_length, gfc_match_old_kind_spec): Do away
1314         with 'cnt'.
1315         (warn_unused_label): Adapt to binary tree.
1316         * match.c (gfc_match_small_literal_int): Only set cnt if non-NULL.
1317         * primary.c (match_kind_param): Do away with cnt.
1319 2006-01-18  Paul Thomas  <pault@gcc.gnu.org>
1321         PR fortran/20869
1322         PR fortran/20875
1323         PR fortran/25024
1324         * symbol.c (check_conflict): Add pointer valued elemental
1325         functions and internal procedures with the external attribute
1326         to the list of conflicts.
1327         (gfc_add_attribute): New catch-all function to perform the
1328         checking of symbol attributes for attribute declaration
1329         statements.
1330         * decl.c (attr_decl1): Call gfc_add_attribute for each of -
1331         (gfc_match_external, gfc_match_intent, gfc_match_intrinsic,
1332         gfc_match_pointer, gfc_match_dimension, gfc_match_target):
1333         Remove spurious calls to checks in symbol.c.  Set the
1334         attribute directly and use the call to attr_decl() for
1335         checking.
1336         * gfortran.h:  Add prototype for gfc_add_attribute.
1338         PR fortran/25785
1339         * resolve.c (resolve_function): Exclude PRESENT from assumed size
1340         argument checking. Replace strcmp's with comparisons with generic
1341         codes.
1343 2006-01-16  Rafael �Ávila de Esp�índola  <rafael.espindola@gmail.com>
1345         * gfortranspec.c (lang_specific_spec_functions): Remove.
1347 2006-01-16  Richard Guenther  <rguenther@suse.de>
1349         * trans-stmt.c (gfc_trans_if_1): Use fold_buildN and build_int_cst.
1350         (gfc_trans_arithmetic_if): Likewise.
1351         (gfc_trans_simple_do): Likewise.
1352         (gfc_trans_do): Likewise.
1353         (gfc_trans_do_while): Likewise.
1354         (gfc_trans_logical_select): Likewise.
1355         (gfc_trans_forall_loop): Likewise.
1356         (generate_loop_for_temp_to_lhs): Likewise.
1357         (generate_loop_for_rhs_to_temp): Likewise.
1358         (gfc_trans_allocate): Likewise.
1359         * trans.c (gfc_add_expr_to_block): Do not fold expr again.
1361 2006-01-16  Richard Guenther  <rguenther@suse.de>
1363         * trans-expr.c (gfc_conv_function_call): Use fold_build2.
1364         * trans-stmt.c (gfc_trans_goto): Likewise.  Use build_int_cst.
1365         * trans.c (gfc_trans_runtime_check): Don't fold the condition
1366         again.
1368 2006-01-13  Steven G. Kargl  <kargls@comcast.net>
1370         PR fortran/25756
1371         * symbol.c (gfc_free_st_label): Give variable meaningful name. Remove
1372         unneeded parenthesis. Fix-up the head of the list (2 lines gleaned
1373         from g95).
1375 2006-01-13  Diego Novillo  <dnovillo@redhat.com>
1377         * trans.c (gfc_add_expr_to_block): Do not fold tcc_statement
1378         nodes.
1380 2006-01-11  Tobias Schl�üter  <tobias.schlueter@physik.uni-muenchen.de>
1382         * parse.c (next_fixed): Remove superfluous string concatenation.
1384 2006-01-11  Bernhard Fischer  <rep.nop@aon.at>
1386         PR fortran/25486
1387         * scanner.c (load_line): use maxlen to determine the line-length used
1388         for padding lines in fixed form.
1390 2006-01-11  Paul Thomas  <pault@gcc.gnu.org>
1392         PR fortran/25730
1393         * trans-types.c (copy_dt_decls_ifequal): Copy backend decl for
1394         character lengths.
1396 2006-01-09  Andrew Pinski  <pinskia@physics.uc.edu>
1398         fortran/24936
1399         * trans-stmt.c (gfc_trans_pointer_assign_need_temp): Use fold_convert
1400         to avoid type mismatch.
1402 2006-01-09  Andrew Pinski  <pinskia@physics.uc.edu>
1404         PR fortran/21977
1405         * trans-decl.c (gfc_generate_function_code): Move the NULLing of
1406         current_fake_result_decl down to below generate_local_vars.
1408 2006-01-09  Feng Wang  <fengwang@nudt.edu.cn>
1410         PR fortran/12456
1411         * trans-expr.c (gfc_to_single_character): New function that converts
1412         string to single character if its length is 1.
1413         (gfc_build_compare_string):New function that compare string and handle
1414         single character specially.
1415         (gfc_conv_expr_op): Use gfc_build_compare_string.
1416         (gfc_trans_string_copy): Use gfc_to_single_character.
1417         * trans-intrinsic.c (gfc_conv_intrinsic_strcmp): Use
1418         gfc_build_compare_string.
1419         * trans.h (gfc_build_compare_string): Add prototype.
1421 2006-01-09  Feng Wang  <fengwang@nudt.edu.cn>
1423         * simplify.c (gfc_simplify_char): Use UCHAR_MAX instead of literal
1424         constant.
1425         (gfc_simplify_ichar): Get the result from unsinged char and in the
1426         range 0 to UCHAR_MAX instead of CHAR_MIN to CHAR_MAX.
1428 2006-01-08  Erik Edelmann  <eedelman@gcc.gnu.org>
1430         PR fortran/25093
1431         * resolve.c (resolve_fntype): Check that PUBLIC functions
1432         aren't of PRIVATE type.
1434 2006-01-07  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
1436         * decl.c (gfc_match_function_decl): Correctly error out in case of
1437         omitted function argument list.
1439 2006-01-07  Paul Thomas  <pault@gcc.gnu.org>
1441         PR fortran/22146
1442         * trans-array.c (gfc_reverse_ss): Remove static attribute.
1443         (gfc_walk_elemental_function_args): Replace gfc_expr * argument for
1444         the function call with the corresponding gfc_actual_arglist*.  Change
1445         code accordingly.
1446         (gfc_walk_function_expr): Call to gfc_walk_elemental_function_args
1447         now requires the actual argument list instead of the expression for
1448         the function call.
1449         * trans-array.h: Modify the prototype for gfc_walk_elemental_function_args
1450         and provide a prototype for gfc_reverse_ss.
1451         * trans-stmt.h (gfc_trans_call): Add the scalarization code for the case
1452         where an elemental subroutine has array valued actual arguments.
1454         PR fortran/25029
1455         PR fortran/21256
1456         PR fortran/20868
1457         PR fortran/20870
1458         * resolve.c (check_assumed_size_reference): New function to check for upper
1459         bound in assumed size array references.
1460         (resolve_assumed_size_actual): New function to do a very restricted scan
1461         of actual argument expressions of those procedures for which incomplete
1462         assumed size array references are not allowed.
1463         (resolve_function, resolve_call): Switch off assumed size checking of
1464         actual arguments, except for elemental procedures and intrinsic
1465         inquiry functions, in some circumstances.
1466         (resolve_variable): Call check_assumed_size_reference.
1468 2006-01-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1470         PR fortran/24268
1471         * io.c (next_char_not_space): New function that returns the next
1472         character that is not white space.
1473         (format_lex): Use the new function to skip whitespace within
1474         a format string.
1476 2006-01-05  Erik Edelmann  <eedelman@gcc.gnu.org>
1478         PR fortran/23675
1479         * expr.c (gfc_expr_set_symbols_referenced): New function.
1480         * gfortran.h: Add a function prototype for it.
1481         * resolve.c (resolve_function): Use it for
1482         use associated character functions lengths.
1483         * expr.c, gfortran.h, resolve.c: Updated copyright years.
1485 2006-01-03  Steven G. Kargl  <kargls@comcast.net>
1487         PR fortran/25101
1488         * resolve.c (resolve_forall_iterators):  Check for scalar variables;
1489         Check stride is nonzero.
1491 2006-01-02  Steven G. Kargl  <kargls@comcast.net>
1493         PR fortran/24640
1494         * parse.c (next_free): Check for whitespace after the label.
1495         * match.c (gfc_match_small_literal_int): Initialize cnt variable.
1497 2006-01-01  Steven G. Kargl  <kargls@comcast.net>
1499         * ChangeLog: Split previous years into ...
1500         * ChangeLog-2002: here.
1501         * ChangeLog-2003: here.
1502         * ChangeLog-2004: here.
1503         * ChangeLog-2005: here.