OSDN Git Service

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