re PR fortran/47745 ([OOP] Segfault with CLASS(*) and derived type dummy arguments)
[platform/upstream/gcc.git] / gcc / fortran / ChangeLog
1 2011-02-16  Janus Weil  <janus@gcc.gnu.org>
2
3         PR fortran/47745
4         * class.c (gfc_build_class_symbol): Set 'class_ok' attribute.
5         * decl.c (build_sym,attr_decl1): Move setting of 'class_ok' into
6         'gfc_build_class_symbol'.
7         (gfc_match_decl_type_spec): Reject unlimited polymorphism.
8         * interface.c (matching_typebound_op): Check for 'class_ok' attribute.
9         * match.c (select_type_set_tmp): Move setting of 'class_ok' into
10         'gfc_build_class_symbol'.
11         * primary.c (gfc_variable_attr): Check for 'class_ok' attribute.
12
13 2011-02-15  Steven G. Kargl  <kargl@gcc.gnu.org>
14
15         PR fortran/47633
16         . simplify.c (gfc_simplify_compiler_version): Fix off-by-one issue.
17
18 2011-02-14  Janus Weil  <janus@gcc.gnu.org>
19
20         PR fortran/47730
21         * parse.c (gfc_build_block_ns): Commit 'block@' symbol.
22
23 2011-02-14  Janus Weil  <janus@gcc.gnu.org>
24
25         PR fortran/47728
26         * class.c (gfc_build_class_symbol): Give a fatal error on polymorphic
27         arrays.
28         * primary.c (gfc_match_varspec): Avoid ICE for invalid class
29         declaration.
30
31 2011-02-14  Janus Weil  <janus@gcc.gnu.org>
32
33         PR fortran/47349
34         * interface.c (get_expr_storage_size): Handle derived-type components.
35
36 2011-02-13  Tobias Burnus  <burnus@net-b.de>
37
38         PR fortran/47569
39         * interface.c (compare_parameter): Avoid ICE with
40         character components.
41
42 2011-02-12  Janus Weil  <janus@gcc.gnu.org>
43
44         * class.c (gfc_build_class_symbol): Reject polymorphic arrays.
45         * decl.c (build_sym,build_struct,attr_decl1): Use return value of
46         'gfc_build_class_symbol'.
47
48 2011-02-12  Michael Matz  <matz@suse.de>
49             Janus Weil  <janus@gcc.gnu.org>
50             Tobias Burnus  <burnus@net-b.de>
51
52         PR fortran/45586
53         * trans-expr.c (conv_parent_component_references): Avoid unintendent
54         skipping of parent compounds.
55
56 2011-02-11  Tobias Burnus  <burnus@net-b.de>
57
58         PR fortran/47550
59         * resolve.c (resolve_formal_arglist): PURE with VALUE
60         and no INTENT: Add -std= diagnostics.
61
62 2011-02-09  Janus Weil  <janus@gcc.gnu.org>
63
64         PR fortran/47352
65         * resolve.c (resolve_procedure_interface): If interface has a result
66         variable, copy the typespec and set result pointer to self.
67
68 2011-02-09  Janus Weil  <janus@gcc.gnu.org>
69
70         PR fortran/47463
71         * resolve.c (resolve_typebound_subroutine): Remove erroneous line.
72
73 2011-02-09  Janus Weil  <janus@gcc.gnu.org>
74
75         PR fortran/47637
76         * trans-decl.c (init_intent_out_dt): Handle CLASS arguments.
77
78 2011-02-08  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
79
80         * io.c (match_io_element): Do not set dt if not inquire.
81
82 2011-02-08  Janus Weil  <janus@gcc.gnu.org>
83
84         PR fortran/45290
85         * expr.c (gfc_check_assign_symbol): Reject pointers as pointer
86         initialization target.
87
88 2011-02-07  Janne Blomqvist  <jb@gcc.gnu.org>
89             Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
90
91         * gfortran.texi (Thread-safety): texinfo styling fixes.
92         * intrinsic.texi: Likewise.
93
94 2011-02-06  Janne Blomqvist  <jb@gcc.gnu.org>
95
96         * gfortran.texi (Compiler Characteristics): Add reference to
97         thread-safety section.
98
99 2011-02-06  Janne Blomqvist  <jb@gcc.gnu.org>
100
101         * gfortran.texi (Thread-safety): New section.
102         * intrinsic.texi (EXECUTE_COMMAND_LINE): Mention thread-safety.
103         (GETENV): Likewise.
104         (GET_ENVIRONMENT_VARIABLE): Likewise.
105         (SYSTEM): Likewise.
106
107 2011-02-06  Paul Thomas  <pault@gcc.gnu.org>
108
109         PR fortran/47592
110         * trans-stmt.c (gfc_trans_allocate): For deferred character
111         length allocations with SOURCE, store to the values and string
112         length to avoid calculating twice.  Replace gfc_start_block
113         with gfc_init_block to avoid unnecessary contexts and to keep
114         declarations of temporaries where they should be. Tidy up the
115         code a bit.
116
117 2011-02-05  Janne Blomqvist  <jb@gcc.gnu.org>
118
119         PR fortran/42434
120         * intrinsic.texi (SYSTEM_CLOCK): Update documentation.
121
122 2011-02-02  Janus Weil  <janus@gcc.gnu.org>
123             Paul Thomas  <pault@gcc.gnu.org>
124
125         PR fortran/47082
126         * trans-expr.c (gfc_trans_class_init_assign): Add call to
127         gfc_get_derived_type.
128         * module.c (read_cleanup): Do not use unique_symtrees for vtabs
129         or vtypes.
130
131 2011-02-02  Janus Weil  <janus@gcc.gnu.org>
132
133         PR fortran/47572
134         * resolve.c (resolve_fl_variable): Handle polymorphic allocatables.
135
136 2011-02-01  Janus Weil  <janus@gcc.gnu.org>
137
138         PR fortran/47565
139         * trans-expr.c (gfc_conv_structure): Handle constructors for procedure
140         pointer components with allocatable result.
141
142 2011-01-31  Janus Weil  <janus@gcc.gnu.org>
143
144         PR fortran/47455
145         * trans-expr.c (gfc_conv_procedure_call): Handle procedure pointers
146         with pointer or allocatable result.
147
148 2011-01-31  Paul Thomas  <pault@gcc.gnu.org>
149
150         PR fortran/47519
151         * trans-stmt.c (gfc_trans_allocate): Improve handling of
152         deferred character lengths with SOURCE.
153         * iresolve.c (gfc_resolve_repeat): Calculate character
154         length from source length and ncopies.
155         * dump-parse-tree.c (show_code_node): Show MOLD and SOURCE
156         expressions for ALLOCATE.
157
158 2011-01-31  Janus Weil  <janus@gcc.gnu.org>
159
160         PR fortran/47463
161         * resolve.c (resolve_typebound_subroutine): Bug fix for the case of
162         an argument of a typebound assignment being a component.
163
164 2011-01-31  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
165
166         * gfortranspec.c (add_arg_libgfortran) [HAVE_LD_STATIC_DYNAMIC] Use
167         LD_STATIC_OPTION, LD_DYNAMIC_OPTION.
168
169 2011-01-31  Tobias Burnus  <burnus@net-b.de>
170
171         PR fortran/47042
172         * resolve.c (resolve_fl_procedure): Reject stmt functions
173         with pointer/allocatable attribute.
174
175 2011-01-31  Tobias Burnus  <burnus@net-b.de>
176
177         PR fortran/47042
178         * interface.c (gfc_procedure_use): Add explicit interface check for
179         pointer/allocatable functions.
180
181 2011-01-30  Paul Thomas  <pault@gcc.gnu.org>
182
183         PR fortran/47523
184         * trans-expr.c (gfc_trans_assignment_1): If the rhs is an op
185         expr and is assigned to a deferred character length scalar,
186         make sure that the function is called before reallocation,
187         so that the length is available. Include procedure pointer
188         and procedure pointer component rhs as well.
189
190         PR fortran/45170
191         PR fortran/35810
192         PR fortran/47350
193         * gfortran.dg/allocatable_function_5.f90: New test not added by
194         mistake on 2011-01-28.
195
196 2011-01-29  Tobias Burnus  <burnus@net-b.de>
197
198         PR fortran/47531
199         * check.c (gfc_check_shape): Support kind argument in SHAPE.
200         * intrinsic.c (add_functions): Ditto.
201         * resolve.c (gfc_resolve_shape): Ditto.
202         * simplify.c (gfc_simplify_shape): Ditto.
203         * intrinsic.h (gfc_check_shape, gfc_resolve_shape,
204         gfc_simplify_shape): Update prototypes.
205         * intrinisc.text (SHAPE): Document kind argument.
206
207 2011-01-28  Tobias Burnus  <burnus@net-b.de>
208
209         PR fortran/47507
210         * resolve.c (resolve_formal_arglist): Allow arguments with VALUE
211         attribute also without INTENT.
212
213 2011-01-28  Tobias Burnus  <burnus@net-b.de>
214
215         * gfortran.texi (Fortran 2003 status): Mention support for
216         nonconstant namelist variables.
217
218 2011-01-28  Paul Thomas  <pault@gcc.gnu.org>
219             Tobias Burnus  <burnus@gcc.gnu.org>
220
221         PR fortran/45170
222         PR fortran/35810
223         PR fortran/47350
224         * interface.c (compare_actual_formal): An allocatable or pointer
225         deferred length actual is only allowed if the formal argument
226         is also deferred length. Clean up whitespace.
227         * trans-expr.c (gfc_conv_procedure_call): Pass string length for
228         deferred character length formal arguments by reference. Do the
229         same for function results.
230         (gfc_trans_pointer_assignment): Do not do runtime check of lhs
231         and rhs character lengths, if deferred length lhs.  In this case
232         set the lhs character length to that of the rhs.
233         (gfc_conv_string_parameter): Remove assert that string length is
234         an integer type.
235         (is_scalar_reallocatable_lhs): New function.
236         (alloc_scalar_allocatable_for_assignment): New function.
237         (gfc_trans_assignment_1): Call above new function. If the rhs is
238         a deferred character length itself, makes ure that the function
239         is called before reallocation, so that the length is available.
240         (gfc_trans_asssignment): Remove error about assignment to
241         deferred length character variables.
242         * gfortran.texi : Update entry about (re)allocation on
243         assignment.
244         * trans-stmt.c (gfc_trans_allocate): Add code to handle deferred
245         length character variables.
246         * module.c (mio_typespec): Transfer deferred characteristic.
247         * trans-types.c (gfc_get_function_type): New code to generate
248         hidden typelist, so that those character lengths that are
249         passed by reference get the right type.
250         * resolve.c (resolve_contained_fntype): Supress error for
251         deferred character length functions.
252         (resolve_function, resolve_fl_procedure) The same.
253         (check_symbols): Remove the error that support for
254         entity with deferred type parameter is not yet implemented.
255         (resolve_fl_derived): The same.
256         match.c (alloc_opt_list): Allow MOLD for deferred length object.
257         * trans-decl.c (gfc_get_symbol_decl): For deferred character
258         length dummies, generate a local variable for string length.
259         (create_function_arglist): Hidden length can be a pointer.
260         (gfc_trans_deferred_vars): For deferred character length
261         results and dummies, assign the string length to the local
262         variable from the hidden argument on entry and the other way
263         round on exit, as appropriate.
264
265 2011-01-27  Tobias Burnus  <burnus@net-b.de>
266
267         PR fortran/47474
268         * trans-decl.c (gfc_generate_function_code): Fix init
269         of allocatable result variable with allocatable components.
270
271 2011-01-27  Tobias Burnus  <burnus@net-b.de>
272
273         PR fortran/47472
274         * options.c (gfc_handle_module_path_options): Save
275         module path without trailing slash as include path.
276
277 2011-01-25  Tobias Burnus  <burnus@net-b.de>
278
279         PR fortran/47448
280         * interface.c (gfc_check_operator_interface): Fix
281         defined-assignment check.
282
283 2011-01-23  Tobias Burnus  <burnus@net-b.de>
284
285         PR fortran/47421
286         * trans-decl.c (gfc_trans_deferred_vars): Do not nullify
287         scalar allocatable dummy arguments.
288
289 2011-01-22  Thomas Koenig  <tkoenig@gcc.gnu.org>
290
291         PR fortran/38536
292         * resolve.c (gfc_iso_c_func_interface):  For C_LOC,
293         check for array sections followed by component references
294         which are illegal.  Also check for coindexed arguments.
295
296 2011-01-22  Tobias Burnus  <burnus@net-b.de>
297
298         PR fortran/47399
299         * primary.c (gfc_match_varspec): Relax gcc_assert to allow for
300         PARAMETER TBP.
301
302 2011-01-21  Tobias Burnus  <burnus@net-b.de>
303
304         PR fortran/47394
305         * error.c (gfc_error_now, gfc_fatal_error, gfc_error_check):
306         Use defined instead of magic number exit status codes.
307         * scanner.c (include_line, gfc_new_file): Ditto.
308
309 2011-01-21  Tobias Burnus  <burnus@net-b.de>
310
311         PR fortran/47377
312         * expr.c (gfc_check_pointer_assign): Reject expr data-targets
313         without pointer attribute.
314
315 2011-01-18  Janus Weil  <janus@gcc.gnu.org>
316
317         PR fortran/47240
318         * resolve.c (expression_rank): Fix rank of procedure poiner components.
319         * trans-expr.c (gfc_conv_procedure_call): Take care of procedure
320         pointer components as actual arguments.
321
322 2011-01-17  Jakub Jelinek  <jakub@redhat.com>
323
324         PR fortran/47331
325         * gfortran.h (struct gfc_omp_saved_state): New type.
326         (gfc_omp_save_and_clear_state, gfc_omp_restore_state): New prototypes.
327         * resolve.c (resolve_global_procedure): Call it around gfc_resolve
328         call.
329         * openmp.c (gfc_omp_save_and_clear_state, gfc_omp_restore_state): New
330         functions.
331
332 2011-01-17  Tobias Burnus  <burnus@net-b.de>
333
334         PR fortran/47327
335         * invoke.texi (Options to request or suppress errors
336         and warnings): Fix cross link.
337
338 2011-01-15  Tobias Burnus  <burnus@net-b.de>
339
340         * gfortran.texi: Update Fortran 2003 Status section.
341
342         PR fortran/47177
343         * invoke.texi: Add missing "-E" to the -dM example.
344
345 2011-01-13  Tobias Burnus  <burnus@net-b.de>
346
347         PR fortran/47268
348         * intrinsic.texi (get_command_argument, get_environment_variable):
349         Mark arguments as optional in the Arguments section.
350
351 2011-01-13  Kai Tietz  <kai.tietz@onevision.com>
352             Tobias Burnus  <burnus@net-b.de>
353
354         PR fortran/47260
355         * trans-decl.c (gfc_get_extern_function_decl,
356         build_function_decl): Set TREE_PUBLIC/TREE_EXTERNAL before
357         calling decl_attributes.
358
359 2011-01-13  Tobias Burnus  <burnus@net-b.de>
360             Mikael Morin  <mikael@gcc.gnu.org>
361
362         PR fortran/45848
363         PR fortran/47204
364         * gfortran.h (gfc_code): Move union ext's case_list into
365         the struct block.
366         * dump-parse-tree.c (show_code_node): Adapt by prefixing case_list
367         by "block.".
368         * frontend-passes.c (gfc_code_walker): Ditto.
369         * match.c (gfc_match_goto, gfc_match_call, gfc_match_case,
370         gfc_match_type_is, gfc_match_class_is): Ditto.
371         * resolve.c (resolve_select, resolve_select_type): Ditto.
372         * st.c (gfc_free_statement): Ditto.
373         * trans-stmt.c (gfc_trans_integer_select, gfc_trans_logical_select,
374         gfc_trans_character_select): Ditto.
375         * parse.c (resolve_all_program_units): For error recovery, avoid
376         segfault is proc_name is NULL.
377
378 2011-01-11  Paul Thomas  <pault@gcc.gnu.org>
379
380         PR fortran/47051
381         * trans-array.c (gfc_alloc_allocatable_for_assignment): Change
382         to be standard compliant by testing for shape rather than size
383         before skipping reallocation. Improve comments.
384
385 2011-01-09  Janus Weil  <janus@gcc.gnu.org>
386
387         PR fortran/47224
388         * resolve.c (resolve_actual_arglist): Remove unneeded and buggy piece
389         of code.
390
391 2011-01-09  Thomas Koenig  <tkoenig@gcc.gnu.org>
392
393         PR fortran/38536
394         * resolve.c (is_scalar_expr_ptr):  For a substring reference,
395         use gfc_dep_compare_expr to compare start and end expession.
396         Add FIXME for using gfc_deb_compare_expr elsewhere.
397
398 2011-01-09  Janus Weil  <janus@gcc.gnu.org>
399
400         PR fortran/46313
401         * class.c (get_unique_type_string): Make type name start with upper
402         case letter.
403
404 2011-01-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
405
406         PR fortran/46405
407         * invoke.texi:  Mention -ffree-line-length-none and
408         -ffixed-line-length-none for preprocessing.
409
410 2011-01-08  Paul Thomas  <pault@gcc.gnu.org>
411
412         PR fortran/46896
413         * trans-expr.c (gfc_conv_procedure_call): With a non-copying
414         procedure argument (eg TRANSPOSE) use a temporary if there is
415         any chance of aliasing due to host or use association.
416         (arrayfunc_assign_needs_temporary): Correct logic for function
417         results and do not use a temporary for implicitly PURE
418         variables.  Use a temporary for Cray pointees.
419         * symbol.c (gfc_add_save): Explicit SAVE not compatible with
420         implicit pureness of containing procedure.
421         * decl.c (match_old_style_init, gfc_match_data): Where decl
422         would fail in PURE procedure, set implicit_pure to zero.
423         * gfortran.h : Add implicit_pure to structure symbol_attr and
424         add prototype for function gfc_implicit_pure.
425         * expr.c (gfc_check_pointer_assign, gfc_check_vardef_context):
426         Where decl would fail in PURE procedure, reset implicit_pure.
427         * io.c (match_vtag, gfc_match_open, gfc_match_close,
428         gfc_match_print, gfc_match_inquire, gfc_match_wait): The same.
429         * match.c (gfc_match_critical, gfc_match_stopcode,
430         sync_statement, gfc_match_allocate, gfc_match_deallocate): The
431         same.
432         * parse.c (decode_omp_directive): The same.
433         (parse_contained): If not PURE, set implicit pure attribute.
434         * resolve.c (resolve_formal_arglist, resolve_structure_cons,
435         resolve_function, resolve_ordinary_assign) : The same.
436         (gfc_implicit_pure): New function.
437         * module.c (mio_symbol_attribute): Introduce AB_IMPLICIT_PURE
438         to ab_attribute enum and use it in this function.
439
440 2011-01-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
441
442         PR fortran/45777
443         * symbol.c (gfc_symbols_could_alias):  Strip gfc_ prefix,
444         make static and move in front of its only caller, to ...
445         * trans-array.c (symbols_could_alias): ... here.
446         Pass information about pointer and target status as
447         arguments.  Allocatable arrays don't alias anything
448         unless they have the POINTER attribute.
449         (gfc_could_be_alias):  Keep track of pointer and target
450         status when following references.  Also check if typespecs
451         of components match those of other components or symbols.
452
453 2011-01-07  Tobias Burnus  <burnus@net-b.de>
454
455         PR fortran/41580
456         * class.c (gfc_build_class_symbol): Mark __vtab as attr.vtab.
457         * intrinsic.c (add_functions): Use simplify functions for
458         EXTENDS_TYPE_OF and SAME_TYPE_AS.
459         * intrinsic.h (gfc_simplify_extends_type_of,
460         gfc_simplify_same_type_as): New prototypes.
461         * simplify.c (is_last_ref_vtab, gfc_simplify_extends_type_of,
462         gfc_simplify_same_type_as): New functions.
463
464 2011-01-07  Janus Weil  <janus@gcc.gnu.org>
465
466         PR fortran/47189
467         PR fortran/47194
468         * gfortran.h (gfc_lval_expr_from_sym): Moved prototype.
469         * class.c (gfc_class_null_initializer): Initialize _vptr to declared
470         type.
471         * expr.c (gfc_lval_expr_from_sym): Moved here from symbol.c.
472         * resolve.c (resolve_deallocate_expr): _data component will be added
473         at translation stage.
474         * symbol.c (gfc_lval_expr_from_sym): Moved to expr.c.
475         * trans-stmt.c (gfc_trans_deallocate): Reset _vptr to declared type.
476
477 2011-01-06  Daniel Franke  <franke.daniel@gmail.com>
478
479         PR fortran/33117
480         PR fortran/46478
481         * parse.c (parse_interface): Remove check for procedure types.
482         * interface.c (check_interface0): Verify that procedures are
483         either all SUBROUTINEs or all FUNCTIONs.
484
485 2011-01-05  Janus Weil  <janus@gcc.gnu.org>
486
487         PR fortran/47180
488         * trans-expr.c (gfc_trans_class_assign): Bugfix for r168524 (make sure
489         'vtab' is initialized).
490
491 2011-01-05  Janus Weil  <janus@gcc.gnu.org>
492
493         PR fortran/47180
494         * trans-expr.c (gfc_trans_class_assign): For a polymorphic NULL pointer
495         assignment, set the _vptr component to the declared type.
496
497 2011-01-05  Thomas Koenig  <tkoenig@gcc.gnu.org>
498
499         PR fortran/46017
500         * resolve.c (resolve_allocate_deallocate): Follow references to
501         check for duplicate occurence of allocation/deallocation objects.
502
503 2011-01-05  Janus Weil  <janus@gcc.gnu.org>
504
505         PR fortran/47024
506         * trans-decl.c (gfc_trans_deferred_vars): Initialize the _vpr component
507         of polymorphic allocatables according to their declared type.
508
509 2011-01-04  Janus Weil  <janus@gcc.gnu.org>
510
511         PR fortran/46448
512         * class.c (gfc_find_derived_vtab): Set the module field for the copying
513         routine to make sure it receives module name mangling.
514
515 2011-01-03  Jakub Jelinek  <jakub@redhat.com>
516
517         * gfortranspec.c (lang_specific_driver): Update copyright notice
518         dates.
519
520 2011-01-03  Janus Weil  <janus@gcc.gnu.org>
521
522         * intrinsic.texi (LEADZ): Fix example.
523
524 2011-01-02  Janus Weil  <janus@gcc.gnu.org>
525
526         PR fortran/46408
527         * class.c (gfc_find_derived_vtab): Use EXEC_INIT_ASSIGN for __copy_
528         routine.
529
530 \f
531 Copyright (C) 2011 Free Software Foundation, Inc.
532
533 Copying and distribution of this file, with or without modification,
534 are permitted in any medium without royalty provided the copyright
535 notice and this notice are preserved.