re PR fortran/56477 (ICE on invalid with pointer assignment to function result)
[platform/upstream/gcc.git] / gcc / fortran / ChangeLog
1 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
2
3         PR fortran/56477
4         * expr.c (gfc_check_pointer_assign): Avoid NULL pointer dereference.
5
6 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
7
8         PR fortran/54730
9         * array.c (gfc_match_array_constructor): Set a checkpoint before
10         matching a typespec.  Drop it on success, restore it otherwise.
11
12 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
13
14         PR fortran/54730
15         * gfortran.h (struct gfc_undo_change_set): New field 'previous'.
16         (gfc_new_undo_checkpoint, gfc_drop_last_undo_checkpoint,
17         gfc_restore_last_undo_checkpoint): New prototypes.
18         * symbol.c (default_undo_chgset_var): Update initialization.
19         (single_undo_checkpoint_p, gfc_new_undo_checkpoint,
20         free_undo_change_set_data, pop_undo_change_set,
21         gfc_drop_last_undo_checkpoint, enforce_single_undo_checkpoint):
22         New functions.
23         (save_symbol_data): Handle multiple change sets.  Make sure old_symbol
24         field's previous value is not overwritten.  Clear gfc_new field.
25         (restore_old_symbol): Restore previous old_symbol field.
26         (gfc_restore_last_undo_checkpoint): New function, using body renamed
27         from gfc_undo_symbols.  Restore the previous change set as current one.
28         (gfc_undo_symbols): New body.
29         (gfc_commit_symbols, gfc_commit_symbol, gfc_enforce_clean_symbol_state):
30         Call enforce_single_undo_checkpoint.
31         (gfc_symbol_done_2): Ditto.  Free change set data.
32
33 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
34
35         * symbol.c (restore_old_symbol): Fix thinko.
36
37 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
38
39         * symbol.c (gfc_undo_symbols): Move code...
40         (restore_old_symbol): ... here as a new function.
41
42 2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>
43
44         * Make-lang.in (F95_PARSER_OBJS): Add dependency to vec.h.
45         * gfortran.h: Include vec.h.
46         (gfc_undo_change_set): New struct.
47         * symbol.c (tentative_tbp): Remove struct.
48         (changed_syms, tentative_tbp_list): Remove variables.
49         (default_undo_chgset_var, latest_undo_chgset): New variables.
50         (save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols,
51         gfc_commit_symbols, gfc_commit_symbol,
52         gfc_enforce_clean_symbol_state, gfc_get_typebound_proc):
53         Use latest_undo_chgset instead of changed_syms and tentative_tbp_list.
54
55 2013-03-01  Tobias Burnus  <burnus@net-b.de>
56
57         PR fortran/56491
58         * iresolve.c (resolve_bound): Use gfc_get_string instead of xstrdup.
59         * symbol.c (free_components): Free proc-pointer components.
60
61 2013-03-01  Tobias Burnus  <burnus@net-b.de>
62
63         * trans-decl.c (gfc_trans_deferred_vars): Free expr after use.
64         * trans-io.c (build_dt): Ditto.
65
66 2013-02-24  Joseph Myers  <joseph@codesourcery.com>
67
68         * resolve.c (generate_component_assignments): Don't use UTF-8
69         ligature in diagnostic.
70
71 2013-02-21  Janus Weil  <janus@gcc.gnu.org>
72
73         PR fortran/56385
74         * trans-array.c (structure_alloc_comps): Handle procedure-pointer
75         components with allocatable result.
76
77 2012-02-21  Tobias Burnus  <burnus@net-b.de>
78
79         PR fortran/56416
80         * gfortran.texi (Part II: Language Reference, Extensions,
81         Non-Fortran Main Program): Sort @menu to match actual section order.
82         * intrinsic.texi (Intrinsic Procedures): Ditto.
83         (C_F_POINTER, PRECISION): Move to the alphabetically correct place.
84
85 2013-02-15  Tobias Burnus  <burnus@net-b.de>
86             Mikael Morin  <mikael@gcc.gnu.org>
87
88         PR fortran/56318
89         * simplify.c (gfc_simplify_matmul): Fix result shape
90         and matmul result.
91
92 2013-02-15  Tobias Burnus  <burnus@net-b.de>
93
94         PR fortran/53818
95         * resolve.c (apply_default_init_local): Don't create an
96         initializer for a result variable.
97
98 2013-02-14  Thomas Koenig  <tkoenig@gcc.gnu.org>
99
100         PR fortran/56224
101         * gfortran.h (gfc_add_include_path):  Add boolean argument
102         for warn.
103         * scanner.c (gfc_add_include_path):  Pass along warn argument
104         to add_path_to_list.
105         * options.c (gfc_post_options):  Add true warn argument to
106         gfc_add_include_path.
107         (gfc_handle_module_path_options):  Likewise.
108         (gfc_handle_option): Also gfc_add_include_path for intrinsic
109         modules, without warning.
110
111 2013-02-14  Paul Thomas  <pault@gcc.gnu.org>
112             Tobias Burnus  <burnus@net-b.de>
113
114         PR testsuite/56138
115         * trans-decl.c (gfc_get_symbol_decl): Fix deferred-length
116         results for functions without extra result variable.
117
118         Revert:
119         2013-01-30  Tobias Burnus  <burnus@net-b.de>
120
121         PR fortran/56138
122         * trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
123         results for functions without extra result variable.
124
125 2013-02-12  Janus Weil  <janus@gcc.gnu.org>
126
127         PR fortran/46952
128         * resolve.c (resolve_call): Do not check deferred procedures for
129         recursiveness.
130
131 2013-02-09  Paul Thomas  <pault@gcc.gnu.org>
132
133         PR fortran/55362
134         * check.c (array_check): It is an error if a procedure is
135         passed.
136
137 2013-02-08  Mikael Morin  <mikael@gcc.gnu.org>
138
139         PR fortran/54107
140         * trans-types.c (gfc_get_function_type): Change a NULL backend_decl
141         to error_mark_node on entry.  Detect recursive types.  Build a variadic
142         procedure type if the type is recursive.  Restore the initial
143         backend_decl.
144
145 2013-02-07  Tobias Burnus  <burnus@net-b.de>
146
147         PR fortran/54339
148         * gfortran.texi (Standards): Mention TS29113.
149         (Varying Length Character): Mention deferred-length
150         strings.
151         (Fortran 2003 Status): Add unlimited polymorphic.
152         (TS 29113 Status): Add TYPE(*) and DIMENSION(..).
153         (C Interop): Update the section about TS29113.
154
155 2013-02-06 Paul Thomas  <pault@gcc.gnu.org>
156
157         PR fortran/55789
158         * trans-array.c (trans_array_constructor): Remove condition
159         'dynamic' = true if the loop ubound is a VAR_DECL.
160
161 2013-02-04  Paul Thomas  <pault@gcc.gnu.org>
162
163         PR fortran/56008
164         PR fortran/47517
165         * trans-array.c (gfc_alloc_allocatable_for_assignment): Save
166         the lhs descriptor before it is modified for reallocation. Use
167         it to deallocate allocatable components in the reallocation
168         block.  Nullify allocatable components for newly (re)allocated
169         arrays.
170
171 2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
172
173         PR fortran/54195
174         * resolve.c (resolve_typebound_procedures): Recurse through
175         resolve_symbol.
176
177 2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
178
179         PR fortran/54107
180         PR fortran/54195
181         * gfortran.h (struct gfc_symbol): New field 'resolved'.
182         * resolve.c (resolve_fl_var_and_proc): Don't skip result symbols.
183         (resolve_symbol): Skip duplicate calls.  Don't check the current
184         namespace.
185
186 2013-02-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
187
188         PR fortran/50627
189         PR fortran/56054
190         * decl.c (gfc_match_end):  Remove half-ready namespace
191         from parent if the end of a block is missing.
192         * parse.c (parse_module):  Do not put namespace into
193         gsymbol on error.
194
195 2013-01-30  Tobias Burnus  <burnus@net-b.de>
196
197         PR fortran/56138
198         * trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
199         results for functions without extra result variable.
200
201 2013-01-29  Janus Weil  <janus@gcc.gnu.org>
202             Mikael Morin <mikael@gcc.gnu.org>
203
204         PR fortran/54107
205         * gfortran.h (gfc_component): Delete members 'formal' and 'formal_ns'.
206         (gfc_copy_formal_args,gfc_copy_formal_args_ppc,gfc_expr_replace_symbols,
207         gfc_expr_replace_comp): Delete.
208         (gfc_sym_get_dummy_args): New prototype.
209         * dependency.c (gfc_check_fncall_dependency): Use
210         'gfc_sym_get_dummy_args'.
211         * expr.c (gfc_is_constant_expr): Ditto.
212         (replace_symbol,gfc_expr_replace_symbols,replace_comp,
213         gfc_expr_replace_comp): Deleted.
214         * frontend-passes.c (doloop_code,do_function): Use
215         'gfc_sym_get_dummy_args'.
216         * interface.c (gfc_check_operator_interface,gfc_compare_interfaces,
217         gfc_procedure_use,gfc_ppc_use,gfc_arglist_matches_symbol,
218         gfc_check_typebound_override): Ditto.
219         * module.c (MOD_VERSION): Bump module version.
220         (mio_component): Do not read/write 'formal' and 'formal_ns'.
221         * resolve.c (resolve_procedure_interface,resolve_fl_derived0): Do not
222         copy formal args, but just keep a pointer to the interface.
223         (resolve_function,resolve_call,resolve_typebound_generic_call,
224         resolve_ppc_call,resolve_expr_ppc,generate_component_assignments,
225         resolve_fl_procedure,gfc_resolve_finalizers,check_generic_tbp_ambiguity,
226         resolve_typebound_procedure,check_uop_procedure): Use
227         'gfc_sym_get_dummy_args'.
228         * symbol.c (free_components): Do not free 'formal' and 'formal_ns'.
229         (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Deleted.
230         (gfc_sym_get_dummy_args): New function.
231         * trans-array.c (get_array_charlen,gfc_walk_elemental_function_args):
232         Use 'gfc_sym_get_dummy_args'.
233         * trans-decl.c (build_function_decl,create_function_arglist,
234         build_entry_thunks,init_intent_out_dt,gfc_trans_deferred_vars,
235         add_argument_checking): Ditto.
236         * trans-expr.c (gfc_map_fcn_formal_to_actual,gfc_conv_procedure_call,
237         gfc_conv_statement_function): Ditto.
238         * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
239         * trans-types.c (create_fn_spec,gfc_get_function_type): Ditto.
240
241 2013-01-28  Tobias Burnus  <burnus@net-b.de>
242             Mikael Morin  <mikael@gcc.gnu.org>
243
244         PR fortran/53537
245         * symbol.c (gfc_find_sym_tree): Don't look for the symbol outside an
246         interface block.
247         (gfc_get_ha_symtree): Let gfc_find_sym_tree lookup the parent namespace.
248         * decl.c (gfc_match_data_decl): Ditto.
249         (variable_decl): Remove undeclared type error.
250         (gfc_match_import): Use renamed instead of original name.
251
252 2013-01-27 Paul Thomas  <pault@gcc.gnu.org>
253
254         PR fortran/55984
255         PR fortran/56047
256         * gfortran.h : Add associate_var to symbol_attr.
257         * resolve.c (resolve_assoc_var): Set associate_var attribute.
258         If the target class_ok is set, set it for the associate
259         variable.
260         * check.c (allocatable_check): Associate variables should not
261         have the allocatable attribute even if their symbols do.
262         * class.c (gfc_build_class_symbol): Symbols with associate_var
263         set will always have a good class container.
264
265 2013-01-23  Janus Weil  <janus@gcc.gnu.org>
266
267         PR fortran/56081
268         * resolve.c (resolve_select): Add argument 'select_type', reject
269         non-scalar expressions.
270         (resolve_select_type,resolve_code): Pass new argument to
271         'resolve_select'.
272
273 2013-01-23  Jakub Jelinek  <jakub@redhat.com>
274
275         PR fortran/56052
276         * trans-decl.c (gfc_get_symbol_decl): Set DECL_ARTIFICIAL
277         and DECL_IGNORED_P on select_type_temporary and don't set
278         DECL_BY_REFERENCE.
279
280 2013-01-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
281
282         PR fortran/55919
283         * scanner.c (add_path_to_list): Copy path to temporary and strip
284         trailing directory separators before calling stat().
285
286 2013-01-17  Richard Biener  <rguenther@suse.de>
287
288         * trans-stmt.c (gfc_trans_do): Conditionally compute countm1
289         dependent on sign of step, avoids repeated evaluation of
290         step sign test.  Avoid undefined overflow issues by using unsigned
291         arithmetic.
292
293 2013-01-16  Janus Weil  <janus@gcc.gnu.org>
294
295         PR fortran/55983
296         * class.c (find_typebound_proc_uop): Check for f2k_derived instead of
297         asserting it.
298
299 2013-01-16  Jakub Jelinek  <jakub@redhat.com>
300             Tobias Burnus  <burnus@net-b.de>
301
302         PR driver/55884
303         * lang.opt (fintrinsic-modules-path): Don't accept Joined.
304         (fintrinsic-modules-path=): New.
305         * options.c (gfc_handle_option, gfc_get_option_string,
306         gfc_get_option_string): Handle the latter.
307
308 2013-01-16  Jakub Jelinek  <jakub@redhat.com>
309
310         PR fortran/52865
311         * trans-stmt.c (gfc_trans_do): Put countm1-- before conditional
312         and use value of countm1 before the decrement in the condition.
313
314 2013-01-15  Paul Thomas  <pault@gcc.gnu.org>
315
316         PR fortran/54286
317         * expr.c (gfc_check_pointer_assign): Check for presence of
318         's2' before using it.
319
320 2013-01-14  Thomas Koenig  <tkoenig@gcc.gnu.org>
321
322         PR fortran/55806
323         * frontend-passes.c (optimize_reduction):  New function,
324         including prototype.
325         (callback_reduction):  Likewise.
326         (gfc_run_passes):  Also run optimize_reduction.
327         (copy_walk_reduction_arg):  New function.
328         (dummy_code_callback):  New function.
329
330 2013-01-13  Jakub Jelinek  <jakub@redhat.com>
331
332         PR fortran/55935
333         * trans-expr.c (gfc_conv_structure): Call
334         unshare_expr_without_location on the ctor elements.
335
336 2013-01-13  Paul Thomas  <pault@gcc.gnu.org>
337
338         PR fortran/54286
339         * expr.c (gfc_check_pointer_assign): Ensure that both lvalue
340         and rvalue interfaces are presented to gfc_compare_interfaces.
341         Simplify references to interface names by using the symbols
342         themselves. Call gfc_compare_interfaces with s1 and s2 inter-
343         changed to overcome the asymmetry of this function. Do not
344         repeat the check for the presence of s1 and s2.
345
346 2013-01-12  Janus Weil  <janus@gcc.gnu.org>
347
348         PR fortran/55072
349         * trans-array.c (gfc_conv_array_parameter): No packing was done for
350         full arrays of derived type.
351
352 2013-01-08  Paul Thomas  <pault@gcc.gnu.org>
353
354         PR fortran/55868
355         * class.c (get_unique_type_string): Change $tar to STAR and
356         replace sprintf by strcpy where there is no formatting.
357         * decl.c (gfc_match_decl_type_spec): Change $tar to STAR.
358
359 2013-01-09  Mikael Morin  <mikael@gcc.gnu.org>
360
361         PR fortran/47203
362         * module.c (check_for_ambiguous): Get the current program unit using
363         gfc_current_ns.
364
365 2013-01-09  Tobias Burnus  <burnus@net-b.de>
366
367         PR fortran/55758
368         * resolve.c (resolve_symbol): Reject non-C_Bool logicals
369         in BIND(C) procedures with -std=f*.
370
371 2013-01-08  Paul Thomas  <pault@gcc.gnu.org>
372
373         PR fortran/55618
374         * trans-expr.c (gfc_conv_procedure_call): Dereference scalar
375         character function arguments to elemental procedures in
376         scalarization loops.
377
378 2013-01-07  Tobias Burnus  <burnus@net-b.de>
379
380         PR fortran/55763
381         * gfortran.h (gfc_check_assign_symbol): Update prototype.
382         * decl.c (add_init_expr_to_sym, do_parm): Update call.
383         * expr.c (gfc_check_assign_symbol): Handle BT_CLASS and
384         improve error location; support components.
385         (gfc_check_pointer_assign): Handle component assignments.
386         * resolve.c (resolve_fl_derived0): Call gfc_check_assign_symbol.
387         (resolve_values): Update call.
388         (resolve_structure_cons): Avoid double diagnostic.
389
390 2013-01-07  Tobias Burnus  <burnus@net-b.de>
391             Thomas Koenig  <tkoenig@gcc.gnu.org>
392
393         PR fortran/55852
394         * expr.c (gfc_build_intrinsic_call): Avoid clashes
395         with user's procedures.
396         * gfortran.h (gfc_build_intrinsic_call): Update prototype.
397         * simplify.c (gfc_simplify_size): Update call.
398         * class.c (finalization_scalarizer, finalization_get_offset,
399         finalizer_insert_packed_call, generate_finalization_wrapper):
400         Clean up by using gfc_build_intrinsic_call.
401
402 2013-01-07  Tobias Burnus  <burnus@net-b.de>
403
404         PR fortran/55763
405         * resolve.c (resolve_select_type): Reject intrinsic types for
406         a non-unlimited-polymorphic selector.
407
408 2013-01-06  Paul Thomas  <pault@gcc.gnu.org>
409
410         PR fortran/53876
411         PR fortran/54990
412         PR fortran/54992
413         * trans-array.c (build_array_ref): Check the TYPE_CANONICAL
414         to see if it is GFC_CLASS_TYPE_P.
415         * trans-expr.c (gfc_get_vptr_from_expr): The same.
416         (gfc_conv_class_to_class): If the types are not the same,
417         cast parmese->expr to the type of ctree.
418         * trans-types.c (gfc_get_derived_type): GFC_CLASS_TYPE_P of
419         CLASS components must be set.
420
421 2013-01-06  Mikael Morin  <mikael@gcc.gnu.org>
422
423         PR fortran/42769
424         PR fortran/45836
425         PR fortran/45900
426         * module.c (read_module): Don't reuse local symtree if the associated
427         symbol isn't exactly the one wanted.  Don't reuse local symtree if it is
428         ambiguous.
429         * resolve.c (resolve_call): Use symtree's name instead of symbol's to
430         lookup the symtree.
431
432 2013-01-05  Steven G. Kargl  <kargl@gcc.gnu.org>
433             Mikael Morin  <mikael@gcc.gnu.org>
434
435         PR fortran/55827
436         * class.c (gfc_fix_class_refs): Adapt ts initialization for the case
437         e->symtree == NULL.
438         * trans-expr.c (gfc_conv_function_expr): Init sym earlier. Use it.
439
440 2013-01-05  Tobias Burnus  <burnus@net-b.de>
441
442         * class.c (finalize_component): Used passed offset expr.
443         (finalization_get_offset): New static function.
444         (finalizer_insert_packed_call, generate_finalization_wrapper): Use it
445         to handle noncontiguous arrays.
446
447 2013-01-04  Tobias Burnus  <burnus@net-b.de>
448
449         * trans.c (gfc_build_final_call): New function.
450         * trans.h (gfc_build_final_call, gfc_conv_scalar_to_descriptor):
451         New function prototypes.
452         * trans-expr.c (gfc_conv_scalar_to_descriptor): Renamed from
453         conv_scalar_to_descriptor, removed static attribute.
454         (gfc_conv_procedure_call): Honor renaming.
455
456 2013-01-04  Tobias Burnus  <burnus@net-b.de>
457
458         * intrinsic.c (add_functions): New internal intrinsic
459         function GFC_PREFIX ("stride").
460         * gfortran.h (gfc_isym_id): Add GFC_ISYM_STRIDE.
461         * intrinsic.h (gfc_resolve_stride): New prototypes.
462         * iresolve.c (gfc_resolve_stride): New function.
463         * trans-intrinsic.c (conv_intrinsic_stride): New static
464         function.
465         (gfc_conv_intrinsic_function): Use it.
466
467 2013-01-04  Tobias Burnus  <burnus@net-b.de>
468
469         * class.c (gfc_find_intrinsic_vtab): Add _final
470         component.
471         * decl.c (gfc_match_null): Remove superfluous
472         variadic argument to gfc_match.
473
474 2013-01-04  Paul Thomas  <pault@gcc.gnu.org>
475
476         PR fortran/55172
477         * match.c (copy_ts_from_selector_to_associate): Remove call to
478         gfc_resolve_expr and replace it with explicit setting of the
479         array reference type.
480         * resolve.c (resolve_select_type): It is an error if the
481         selector is coindexed.
482
483 2013-01-04  Tobias Burnus  <burnus@net-b.de>
484
485         PR fortran/55763
486         * decl.c (gfc_match_null): Parse and reject MOLD.
487
488 2013-01-04  Tobias Burnus  <burnus@net-b.de>
489
490         PR fortran/55854
491         PR fortran/55763
492         * class.c (gfc_class_null_initializer): Fix finding the vtab.
493         (gfc_find_intrinsic_vtab): Use BT_VOID for some components.
494
495 2013-01-03  Janus Weil  <janus@gcc.gnu.org>
496
497         PR fortran/55855
498         * expr.c (gfc_check_assign): Use 'gfc_expr_attr' to evaluate attributes
499         of rvalue. Correct hyphenation in error message.
500
501 2013-01-03  Jakub Jelinek  <jakub@redhat.com>
502
503         * gfortranspec.c (lang_specific_driver): Update copyright notice
504         dates.
505 \f
506 Copyright (C) 2013 Free Software Foundation, Inc.
507
508 Copying and distribution of this file, with or without modification,
509 are permitted in any medium without royalty provided the copyright
510 notice and this notice are preserved.