1 2023-09-01 Harald Anlauf <anlauf@gmx.de>
4 * trans-array.cc (gfc_conv_ss_startstride): For array bounds checking,
5 consider also array constructors in expressions, and use their shape.
7 2023-08-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
9 * gfortran.texi: Likewise.
11 2023-08-30 Mikael Morin <mikael@gcc.gnu.org>
14 * gfortran.h (gfc_drop_interface_elements_before): New prototype.
15 (gfc_current_interface_head): Return a reference to the pointer.
16 * interface.cc (gfc_current_interface_head): Ditto.
17 (free_interface_elements_until): New function, generalizing
19 (gfc_free_interface): Use free_interface_elements_until.
20 (gfc_drop_interface_elements_before): New function.
22 (current_interface_ptr, previous_interface_head): New static variables.
23 (current_interface_valid_p, get_current_interface_ptr): New functions.
24 (decode_statement): Initialize previous_interface_head.
25 (reject_statement): Restore current interface pointer to point to
26 previous_interface_head.
28 2023-08-26 Paul Thomas <pault@gcc.gnu.org>
31 * trans-expr.cc (gfc_trans_arrayfunc_assign): Supply a missing
32 dereference for the call to gfc_deallocate_alloc_comp_no_caf.
34 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
36 * gfortran.h (struct gfc_namespace): Add omp_structured_block bit.
37 * openmp.cc: Include omp-api.h.
38 (resolve_omp_clauses): Consolidate inscan reduction clause conflict
40 (find_nested_loop_in_chain): New.
41 (find_nested_loop_in_block): New.
42 (gfc_resolve_omp_do_blocks): Set omp_current_do_collapse properly.
43 Handle imperfectly-nested loops when looking for nested omp scan.
44 Refactor to move inscan reduction clause conflict checking to
46 (gfc_resolve_do_iterator): Handle imperfectly-nested loops.
47 (struct icode_error_state): New.
48 (icode_code_error_callback): New.
49 (icode_expr_error_callback): New.
50 (diagnose_intervening_code_errors_1): New.
51 (diagnose_intervening_code_errors): New.
52 (make_structured_block): New.
53 (restructure_intervening_code): New.
54 (is_outer_iteration_variable): Do not assume loops are perfectly
56 (check_nested_loop_in_chain): New.
57 (check_nested_loop_in_block_state): New.
58 (check_nested_loop_in_block_symbol): New.
59 (check_nested_loop_in_block): New.
60 (expr_uses_intervening_var): New.
61 (is_intervening_var): New.
62 (expr_is_invariant): Do not assume loops are perfectly nested.
63 (resolve_omp_do): Handle imperfectly-nested loops.
64 * trans-stmt.cc (gfc_trans_block_construct): Generate
65 OMP_STRUCTURED_BLOCK if magic bit is set on block namespace.
67 2023-08-25 Harald Anlauf <anlauf@gmx.de>
70 * data.cc (get_array_index): Add bounds-checking code and return error
71 status. Overindexing will be allowed as an extension for -std=legacy
72 and generate an error in standard-conforming mode.
73 (gfc_assign_data_value): Use error status from get_array_index for
74 graceful error recovery.
76 2023-08-25 Uros Bizjak <ubizjak@gmail.com>
78 * match.cc (gfc_match_equivalence): Rename TRUE/FALSE to true/false.
79 * module.cc (check_access): Ditto.
80 * primary.cc (match_real_constant): Ditto.
81 * trans-array.cc (gfc_trans_allocate_array_storage): Ditto.
82 (get_array_ctor_strlen): Ditto.
83 * trans-common.cc (find_equivalence): Ditto.
84 (add_equivalences): Ditto.
86 2023-08-23 Harald Anlauf <anlauf@gmx.de>
89 * resolve.cc (is_non_constant_shape_array): Add forward declaration.
90 (resolve_common_vars): Diagnose automatic array object in COMMON.
91 (resolve_symbol): Prevent confusing follow-on error.
93 2023-08-22 Tobias Burnus <tobias@codesourcery.com>
95 * gfortran.h (enum gfc_omp_defaultmap_category):
96 Add OMP_DEFAULTMAP_CAT_ALL.
97 * openmp.cc (gfc_match_omp_clauses): Parse
99 * trans-openmp.cc (gfc_trans_omp_clauses): Handle it.
101 2023-08-22 Harald Anlauf <anlauf@gmx.de>
104 * data.cc (gfc_advance_section): Derive next index set and next offset
105 into DATA variable also for array references using vector sections.
106 Use auxiliary array to keep track of offsets into indexing vectors.
107 (gfc_get_section_index): Set up initial indices also for DATA variables
108 with array references using vector sections.
109 * data.h (gfc_get_section_index): Adjust prototype.
110 (gfc_advance_section): Likewise.
111 * resolve.cc (check_data_variable): Pass vector offsets.
113 2023-08-16 Harald Anlauf <anlauf@gmx.de>
116 * trans-expr.cc (conv_scalar_char_value): Use gfc_replace_expr to
117 avoid leaking replaced gfc_expr.
119 2023-08-15 Martin Jambor <mjambor@suse.cz>
120 Harald Anlauf <anlauf@gmx.de>
123 * resolve.cc (resolve_structure_cons): Check comp->ts is character
124 type before accessing stuff through comp->ts.u.cl.
126 2023-08-15 Chung-Lin Tang <cltang@codesourcery.com>
127 Thomas Schwinge <thomas@codesourcery.com>
129 * openmp.cc (OACC_DATA_CLAUSES): Add OMP_CLAUSE_DEFAULT.
131 2023-08-14 Mikael Morin <mikael@gcc.gnu.org>
135 * trans-types.cc (gfc_sym_type): Use a bare character type for length
136 one value character dummy arguments.
137 * trans-expr.cc (gfc_conv_string_parameter): Handle single character
139 (gfc_conv_procedure_call): Don't exclude interoperable kinds
140 from single character handling. For single character dummy arguments,
141 extend the existing handling of non-constant expressions to constant
144 2023-08-14 Mikael Morin <mikael@gcc.gnu.org>
146 * gfortran.h (gfc_length_one_character_type_p): New inline
148 * check.cc (is_c_interoperable): Use
149 gfc_length_one_character_type_p.
150 * decl.cc (verify_bind_c_sym): Same.
151 * trans-expr.cc (gfc_conv_procedure_call): Same.
153 2023-08-09 Steve Kargl <sgk@troutmask.apl.washington.edu>
156 * resolve.cc (resolve_types): Exclude contained procedures with
157 the artificial attribute from test for pureness.
159 2023-07-31 Chung-Lin Tang <cltang@codesourcery.com>
161 * openmp.cc (resolve_omp_clauses): Add checking requiring
162 OpenACC host_data construct to have an use_device clause.
164 2023-07-28 Harald Anlauf <anlauf@gmx.de>
167 * gfortran.texi: Clarify argument passing convention.
168 * trans-expr.cc (gfc_conv_procedure_call): Do not pass the character
169 length as hidden argument when the declared dummy argument is
172 2023-07-27 Tobias Burnus <tobias@codesourcery.com>
174 * openmp.cc (resolve_omp_target): Minor cleanup.
175 * parse.cc (decode_omp_directive): Find TARGET statement
176 also higher in the stack.
178 2023-07-26 Harald Anlauf <anlauf@gmx.de>
181 * resolve.cc (check_data_variable): Do not accept strings with
182 deferred length or non-constant length in a DATA statement.
183 Reject also substrings of string variables of non-constant length.
185 2023-07-25 Tobias Burnus <tobias@codesourcery.com>
189 * gfortran.h (gfc_omp_clauses): Add target_first_st_is_teams.
190 * parse.cc (parse_omp_structured_block): Set it if the first
191 statement in the structured block of a TARGET is TEAMS or
192 a combined/composite starting with TEAMS.
193 * openmp.cc (resolve_omp_target): Also show an error for
194 contains_teams_construct without target_first_st_is_teams.
196 2023-07-24 Tobias Burnus <tobias@codesourcery.com>
200 * gfortran.h (gfc_omp_clauses): Add contains_teams_construct.
201 * openmp.cc (resolve_omp_target): New; check for teams nesting.
202 (gfc_resolve_omp_directive): Call it.
203 * parse.cc (decode_omp_directive): Set contains_teams_construct
204 on enclosing ST_OMP_TARGET.
206 2023-07-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
208 * trans-intrinsic.cc (conv_intrinsic_ieee_comparison): Only
211 2023-07-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
213 * f95-lang.cc (gfc_init_builtin_functions): Add __builtin_iseqsig.
214 * trans-intrinsic.cc (conv_intrinsic_ieee_comparison): New
216 (gfc_conv_ieee_arithmetic_function): Handle IEEE comparisons.
218 2023-07-19 Tobias Burnus <tobias@codesourcery.com>
221 * trans-openmp.cc (gfc_nonrect_loop_expr): Accept all
223 (gfc_trans_omp_do): Likewise; use sign to determine
226 2023-07-17 Harald Anlauf <anlauf@gmx.de>
230 * trans-expr.cc (gfc_conv_procedure_call): For intrinsic procedures
231 whose result characteristics depends on the first argument and which
232 can be of type character, the character length will not be deferred.
234 2023-07-17 Tobias Burnus <tobias@codesoucery.com>
235 Chung-Lin Tang <cltang@codesourcery.com>
237 * dump-parse-tree.cc (show_omp_namelist, show_omp_clauses): Dump
238 uses_allocators clause.
239 * gfortran.h (gfc_free_omp_namelist): Add memspace_sym to u union
240 and traits_sym to u2 union.
241 (OMP_LIST_USES_ALLOCATORS): New enum value.
242 (gfc_free_omp_namelist): Add 'bool free_mem_traits_space' arg.
243 * match.cc (gfc_free_omp_namelist): Likewise.
244 * openmp.cc (gfc_free_omp_clauses, gfc_match_omp_variable_list,
245 gfc_match_omp_to_link, gfc_match_omp_doacross_sink,
246 gfc_match_omp_clause_reduction, gfc_match_omp_allocate,
247 gfc_match_omp_flush): Update call.
248 (gfc_match_omp_clauses): Likewise. Parse uses_allocators clause.
249 (gfc_match_omp_clause_uses_allocators): New.
250 (enum omp_mask2): Add new OMP_CLAUSE_USES_ALLOCATORS.
251 (OMP_TARGET_CLAUSES): Accept it.
252 (resolve_omp_clauses): Resolve uses_allocators clause
253 * st.cc (gfc_free_statement): Update gfc_free_omp_namelist call.
254 * trans-openmp.cc (gfc_trans_omp_clauses): Handle
255 OMP_LIST_USES_ALLOCATORS; fail with sorry unless predefined allocator.
256 (gfc_split_omp_clauses): Handle uses_allocators.
258 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
261 * trans.h (gfc_deallocate_with_status): Add class container
263 (gfc_deallocate_scalar_with_status): Ditto.
264 * trans.cc (gfc_deallocate_with_status): Add class container
265 argument and pass it down to gfc_add_finalize_call.
266 (gfc_deallocate_scalar_with_status): Same.
267 * trans-array.cc (structure_alloc_comps): Update caller.
268 * trans-stmt.cc (gfc_trans_deallocate): Ditto.
269 * trans-expr.cc (gfc_conv_procedure_call): Ditto. Pass
270 pre-evaluated class container argument if it's available.
272 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
275 * trans.h (gfc_add_finalizer_call): Add class container argument.
276 * trans.cc (gfc_add_finalizer_call): Ditto. Pass down new
277 argument to get_final_proc_ref, get_elem_size, get_var_desc,
279 (get_elem_size): Add class container argument.
280 Use provided class container if it's available.
281 (get_var_descr): Same.
283 (get_final_proc_ref): Same. Add boolean telling the class
284 container argument is used. Set it. Don't try to use
285 final_wrapper if class container argument was used.
287 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
289 * trans.cc (get_var_descr): Factor scalar descriptor generation.
291 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
293 * trans.cc (get_vptr): New function.
294 (gfc_add_finalizer_call): Move virtual table pointer evaluation
297 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
299 * trans.cc (get_var_descr): Remove argument ts. Use var->ts
301 (gfc_add_finalizer_call): Update caller.
303 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
305 * trans.cc (gfc_add_finalizer_call): Inline definition of
306 variable has_finalizer. Merge nested conditions.
308 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
310 * trans.cc (gfc_add_finalizer_call): Remove local variable
311 final_expr. Pass down expr to get_final_proc_ref and move
312 final procedure expression generation down to its one usage
313 in get_final_proc_ref.
314 (get_final_proc_ref): Add argument expr. Remove argument
315 final_wrapper. Recreate final_wrapper from expr.
317 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
319 * trans.cc (gfc_add_finalizer_call): Remove local variable
320 elem_size. Pass expression to get_elem_size and move the
321 element size expression generation close to its usage there.
322 (get_elem_size): Add argument expr, remove class_size argument
323 and rebuild it from expr. Remove ts argument and use the
324 type of expr instead.
326 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
328 * trans.cc (gfc_add_finalizer_call): Move pre and post code for
329 the final procedure pointer expression to the outer block.
330 Reuse the previously evaluated final procedure pointer
333 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
335 * trans.cc (gfc_add_finalizer_call): Add post code for desc_se
336 after the finalizer call. Add post code for final_se and
339 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
341 * trans.cc (gfc_build_final_call): Inline...
342 (gfc_add_finalizer_call): ... to its one caller.
344 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
346 * trans.cc (get_var_descr): New function.
347 (gfc_build_final_call): Outline the data reference descriptor
348 evaluation code to get_var_descr.
350 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
352 * trans.cc (get_elem_size): New function.
353 (gfc_build_final_call): Outline the element size evaluation
356 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
358 * trans.cc (get_final_proc_ref): New function.
359 (gfc_build_final_call): Outline the pointer evaluation code
360 to get_final_proc_ref.
362 2023-07-17 Mikael Morin <mikael@gcc.gnu.org>
364 * trans.cc (gfc_build_final_call): Remove commented assertion.
366 2023-07-14 Mikael Morin <mikael@gcc.gnu.org>
369 * trans.h (gfc_reset_vptr): Add class_container argument.
370 * trans-expr.cc (gfc_reset_vptr): Ditto. If a valid vptr can
371 be obtained through class_container argument, bypass evaluation
373 (gfc_conv_procedure_call): Wrap the argument evaluation code
374 in a conditional if the associated dummy is optional. Evaluate
375 the data reference to a pointer now, and replace later
376 references with usage of the pointer.
378 2023-07-14 Mikael Morin <mikael@gcc.gnu.org>
381 * trans.h (struct gfc_se): New field class_container.
382 (struct gfc_ss_info): Ditto.
383 (gfc_evaluate_data_ref_now): New prototype.
384 * trans.cc (gfc_evaluate_data_ref_now): Implement it.
385 * trans-array.cc (gfc_conv_ss_descriptor): Copy class_container
386 field from gfc_se struct to gfc_ss_info struct.
387 (gfc_conv_expr_descriptor): Copy class_container field from
388 gfc_ss_info struct to gfc_se struct.
389 * trans-expr.cc (gfc_conv_class_to_class): Use class container
390 set in class_container field if available.
391 (gfc_conv_variable): Set class_container field on encountering
392 class variables or components, clear it on encountering
393 non-class components.
394 (gfc_conv_procedure_call): Evaluate data ref to a pointer now,
395 and replace later references by usage of the pointer.
397 2023-07-14 Mikael Morin <mikael@gcc.gnu.org>
400 * trans-expr.cc (gfc_conv_procedure_call): Use a separate gfc_se
401 struct, initalized from parmse, to generate the class wrapper.
402 After the class wrapper code has been generated, copy it back
403 depending on whether parameter deallocation code has been
406 2023-07-13 Mikael Morin <mikael@gcc.gnu.org>
409 * symbol.cc (gfc_restore_last_undo_checkpoint): Release symbols
412 2023-07-12 Andre Vehreschild <vehre@gcc.gnu.org>
415 * expr.cc (find_inquiry_ref): Replace len of pdt_string by
417 (simplify_ref_chain): Ensure input to find_inquiry_ref is
419 (gfc_match_init_expr): Prevent PDT analysis for function calls.
420 (gfc_pdt_find_component_copy_initializer): Get the initializer
421 value for given component.
422 * gfortran.h (gfc_pdt_find_component_copy_initializer): New
424 * simplify.cc (gfc_simplify_len): Replace len() of PDT with pdt
425 component ref or constant.
427 2023-07-11 Harald Anlauf <anlauf@gmx.de>
430 * symbol.cc (gfc_copy_formal_args_intr): When deriving the formal
431 argument attributes from the actual ones for intrinsic procedure
432 calls, take special care of CHARACTER arguments that we do not
433 wrongly treat them formally as deferred-length.
435 2023-07-08 Steve Kargl <sgk@troutmask.apl.washington.edu>
439 * match.cc (gfc_match_namelist): Check for host associated or
440 defined types before applying default type.
441 (gfc_match_select_rank): Apply default type to selector of
442 unknown type if possible.
443 * resolve.cc (resolve_fl_variable): Do not apply local default
444 initialization to assumed rank entities.
446 2023-07-08 Harald Anlauf <anlauf@gmx.de>
447 Steven G. Kargl <kargl@gcc.gnu.org>
450 * trans-expr.cc (gfc_conv_procedure_call): Check procedures for
451 allocatable dummy arguments with INTENT(OUT) and move deallocation
452 of actual arguments after evaluation of argument expressions before
453 the procedure is executed.
455 2023-07-08 Harald Anlauf <anlauf@gmx.de>
458 * arith.cc (gfc_compare_expr): Handle equality comparison of constant
459 complex gfc_expr arguments.
461 2023-07-05 Robin Dapp <rdapp@ventanamicro.com>
462 Juzhe-Zhong <juzhe.zhong@rivai.ai>
464 * trans-types.cc (gfc_type_for_mode): Ditto.
466 2023-06-28 Harald Anlauf <anlauf@gmx.de>
469 * trans-expr.cc (gfc_conv_procedure_call): For non-constant string
470 argument passed to CHARACTER(LEN=1),VALUE dummy, ensure proper
471 dereferencing and truncation of string to length 1.
473 2023-06-28 Paul Thomas <pault@gcc.gnu.org>
476 * expr.cc (gfc_is_ptr_fcn): Remove reference to class_pointer.
477 * resolve.cc (resolve_assoc_var): Call gfc_is_ptr_fcn to allow
478 associate names with pointer function targets to be used in
479 variable definition context.
480 * trans-decl.cc (get_symbol_decl): Remove extraneous line.
481 * trans-expr.cc (alloc_scalar_allocatable_subcomponent): Obtain
482 size of intrinsic and character expressions.
483 (gfc_trans_subcomponent_assign): Expand assignment to class
484 components to include intrinsic and character expressions.
486 2023-06-24 Harald Anlauf <anlauf@gmx.de>
489 * trans-expr.cc (gfc_conv_procedure_call): Truncate constant string
490 argument of length > 1 passed to scalar CHARACTER(1),VALUE dummy.
492 2023-06-23 Harald Anlauf <anlauf@gmx.de>
495 * trans-expr.cc (gfc_conv_procedure_call): Pass actual argument
496 to scalar CHARACTER(1),VALUE dummy argument by value.
498 2023-06-21 Paul Thomas <pault@gcc.gnu.org>
505 * decl.cc (char_len_param_value): Fix memory leak.
506 (resolve_block_construct): Remove unnecessary static decls.
507 * expr.cc (gfc_is_ptr_fcn): New function.
508 (gfc_check_vardef_context): Use it to permit pointer function
509 result selectors to be used for associate names in variable
511 * gfortran.h: Prototype for gfc_is_ptr_fcn.
512 * match.cc (build_associate_name): New function.
513 (gfc_match_select_type): Use the new function to replace inline
514 version and to build a new associate name for the case where
515 the supplied associate name is already used for that purpose.
516 * resolve.cc (resolve_assoc_var): Call gfc_is_ptr_fcn to allow
517 associate names with pointer function targets to be used in
518 variable definition context.
519 * trans-decl.cc (gfc_get_symbol_decl): Unlimited polymorphic
520 variables need deferred initialisation of the vptr.
521 (gfc_trans_deferred_vars): Do the vptr initialisation.
522 * trans-stmt.cc (trans_associate_var): Ensure that a pointer
523 associate name points to the target of the selector and not
526 2023-06-21 Paul Thomas <pault@gcc.gnu.org>
529 * trans-expr.cc (gfc_conv_procedure_call): The hidden string
530 length must not be passed to a formal arg of type(cptr).
532 2023-06-20 Tobias Burnus <tobias@codesourcery.com>
534 * dump-parse-tree.cc (show_omp_namelist): Fix dump of the allocator
535 modifier of OMP_LIST_ALLOCATE.
537 2023-06-20 Tobias Burnus <tobias@codesourcery.com>
539 * match.cc (gfc_match_char): Match with '%S' a symbol
542 2023-06-19 Tobias Burnus <tobias@codesourcery.com>
544 * intrinsic.texi (OpenMP Modules OMP_LIB and OMP_LIB_KINDS): Also
545 add references to the OpenMP 5.1 and 5.2 spec; add omp_initial_device
546 and omp_invalid_device named constants.
548 2023-06-13 Harald Anlauf <anlauf@gmx.de>
549 Mikael Morin <mikael@gcc.gnu.org>
552 * trans-array.cc (gfc_trans_allocate_array_storage): When passing a
553 zero-sized array with fixed (= non-dynamic) size, allocate temporary
554 by the caller, not by the callee.
556 2023-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
558 * f95-lang.cc (gfc_init_builtin_functions): Add fmax() and
559 fmin() built-ins, and their variants.
560 * mathbuiltins.def: Add FMAX and FMIN built-ins.
561 * trans-intrinsic.cc (conv_intrinsic_ieee_minmax): New function.
562 (gfc_conv_ieee_arithmetic_function): Handle IEEE_MIN_NUM and
563 IEEE_MAX_NUM functions.
565 2023-06-09 Jakub Jelinek <jakub@redhat.com>
568 * primary.cc (gfc_convert_to_structure_constructor): Only do
569 constant string ctor length verification and truncation/padding
570 if constant length has INTEGER type.
572 2023-06-08 Paul Thomas <pault@gcc.gnu.org>
578 * decl.cc (char_len_param_value): Simplify a copy of the expr
579 and replace the original if there is no error.
580 * gfortran.h : Remove the redundant field 'rankguessed' from
581 'gfc_association_list'.
582 * resolve.cc (resolve_assoc_var): Remove refs to 'rankguessed'.
583 (resolve_variable): Associate names with constant or structure
584 constructor targets cannot have array refs.
585 * trans-array.cc (gfc_conv_expr_descriptor): Guard expression
586 character length backend decl before using it. Suppress the
587 assignment if lhs equals rhs.
588 * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
589 associate variables pointing to a variable. Add comment.
590 * trans-stmt.cc (trans_associate_var): Remove requirement that
591 the character length be deferred before assigning the value
592 returned by gfc_conv_expr_descriptor. Also, guard the backend
593 decl before testing with VAR_P.
595 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com>
596 Tobias Burnus <tobias@codesourcery.com>
598 * dump-parse-tree.cc (show_omp_namelist): Display 'present' map
600 (show_omp_clauses): Display 'present' motion modifier for 'to'
602 * gfortran.h (enum gfc_omp_map_op): Add entries with 'present'
604 (struct gfc_omp_namelist): Add 'present_modifer'.
605 * openmp.cc (gfc_match_motion_var_list): New, handles optional
606 'present' modifier for to/from clauses.
607 (gfc_match_omp_clauses): Call it for to/from clauses; parse 'present'
608 in defaultmap and map clauses.
609 (resolve_omp_clauses): Allow 'present' modifiers on 'target',
610 'target data', 'target enter' and 'target exit' directives.
611 * trans-openmp.cc (gfc_trans_omp_clauses): Apply 'present' modifiers
612 to tree node for 'map', 'to' and 'from' clauses. Apply 'present' for
615 2023-06-02 Steve Kargl <kargl@gcc.gnu.org>
618 * resolve.cc (resolve_select_rank): Remove duplicate error.
619 (resolve_fl_var_and_proc): Prevent NULL pointer dereference and
620 suppress error message for temporary.
622 2023-06-02 Paul Thomas <pault@gcc.gnu.org>
625 * parse.cc (parse_associate): Replace the existing evaluation
626 of the target rank with calls to gfc_resolve_ref and
627 gfc_expression_rank. Identify untyped target function results
628 with structure constructors by finding the appropriate derived
630 * resolve.cc (resolve_symbol): Allow associate variables to be
633 2023-06-01 Harald Anlauf <anlauf@gmx.de>
636 * decl.cc (gfc_match_kind_spec): Use error path on missing right
638 (gfc_match_decl_type_spec): Use error return when an error occurred
639 during matching a KIND specifier.
641 2023-06-01 Tobias Burnus <tobias@codesourcery.com>
643 * parse.cc (decode_omp_directive): Accept all pure directives
644 inside a PURE procedures; handle 'error at(execution).
646 2023-05-26 Tobias Burnus <tobias@codesourcery.com>
648 * dump-parse-tree.cc (show_omp_namelist): Update allocator, fix
650 (show_omp_node, show_code_node): Handle EXEC_OMP_ALLOCATE.
651 * gfortran.h (enum gfc_statement): Add ST_OMP_ALLOCATE and ..._EXEC.
652 (enum gfc_exec_op): Add EXEC_OMP_ALLOCATE.
653 (struct gfc_omp_namelist): Add 'allocator' to 'u2' union.
654 (struct gfc_namespace): Add omp_allocate.
655 (gfc_resolve_omp_allocate): New.
656 * match.cc (gfc_free_omp_namelist): Free 'u2.allocator'.
657 * match.h (gfc_match_omp_allocate, gfc_match_omp_allocators): New.
658 * openmp.cc (gfc_omp_directives): Uncomment allocate/allocators.
659 (gfc_match_omp_variable_list): Add bool arg for
660 rejecting listening common-block vars separately.
661 (gfc_match_omp_clauses): Update for u2.allocators.
662 (OMP_ALLOCATORS_CLAUSES, gfc_match_omp_allocate,
663 gfc_match_omp_allocators, is_predefined_allocator,
664 gfc_resolve_omp_allocate): New.
665 (resolve_omp_clauses): Update 'allocate' clause checks.
666 (omp_code_to_statement, gfc_resolve_omp_directive): Handle
667 OMP ALLOCATE/ALLOCATORS.
668 * parse.cc (in_exec_part): New global var.
669 (check_omp_allocate_stmt, parse_openmp_allocate_block): New.
670 (decode_omp_directive, case_exec_markers, case_omp_decl,
671 gfc_ascii_statement, parse_omp_structured_block): Handle
672 OMP allocate/allocators.
673 (verify_st_order, parse_executable): Set in_exec_part.
674 * resolve.cc (gfc_resolve_blocks, resolve_codes): Handle
676 * st.cc (gfc_free_statement): Likewise.
677 * trans.cc (trans_code): Likewise.
678 * trans-openmp.cc (gfc_trans_omp_directive): Likewise.
679 (gfc_trans_omp_clauses, gfc_split_omp_clauses): Update for
680 u2.allocator, fix for u.align.
682 2023-05-24 Harald Anlauf <anlauf@gmx.de>
685 * simplify.cc (simplify_size): Reject DIM argument of intrinsic SIZE
686 with error when out of valid range.
688 2023-05-24 Harald Anlauf <anlauf@gmx.de>
691 * check.cc (gfc_check_reshape): Expand constant arguments SHAPE and
692 ORDER before checking.
693 * gfortran.h (gfc_is_constant_array_expr): Add prototype.
694 * iresolve.cc (gfc_resolve_reshape): Expand constant argument SHAPE.
695 * simplify.cc (is_constant_array_expr): If array is determined to be
696 constant, expand small array constructors if needed.
697 (gfc_is_constant_array_expr): Wrapper for is_constant_array_expr.
698 (gfc_simplify_reshape): Fix check for insufficient elements in SOURCE
699 when no padding specified.
701 2023-05-23 Paul Thomas <pault@gcc.gnu.org>
704 * resolve.cc (gfc_resolve_ref): Conversion of array_ref into an
705 element should be done for all characters without a len expr,
706 not just deferred lens, and for integer expressions.
707 * trans-expr.cc (conv_inquiry): For len and kind inquiry refs,
708 set the se string_length to NULL_TREE.
710 2023-05-23 Paul Thomas <pault@gcc.gnu.org>
711 Steven G. Kargl <kargl@gcc.gnu.org>
714 * decl.cc (variable_decl): Clean up white space issues.
715 (gfc_match_final_decl): Declaration of finalizable derived type
716 is allowed in a submodule.
718 2023-05-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
720 * expr.cc (gfc_get_corank): Use CLASS_DATA from gfortran.h.
721 * resolve.cc (resolve_component): Same.
722 (resolve_fl_derived0): Same.
723 * simplify.cc (gfc_simplify_extends_type_of): Same.
724 (simplify_cobound): Same.
726 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
728 * trans-array.cc (is_pointer_array): Use _P() defines from tree.h.
729 (gfc_conv_scalarized_array_ref): Ditto.
730 (gfc_conv_array_ref): Ditto.
731 * trans-decl.cc (gfc_finish_decl): Ditto.
732 (gfc_get_symbol_decl): Ditto.
733 * trans-expr.cc (gfc_trans_pointer_assignment): Ditto.
734 (gfc_trans_arrayfunc_assign): Ditto.
735 (gfc_trans_assignment_1): Ditto.
736 * trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto.
737 (conv_intrinsic_ieee_value): Ditto.
738 * trans-io.cc (gfc_convert_array_to_string): Ditto.
739 * trans-openmp.cc (gfc_omp_is_optional_argument): Ditto.
740 (gfc_trans_omp_clauses): Ditto.
741 * trans-stmt.cc (gfc_conv_label_variable): Ditto.
742 * trans.cc (gfc_build_addr_expr): Ditto.
743 (get_array_span): Ditto.
745 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
748 * array.cc (compare_bounds): Use narrower return type.
749 (gfc_compare_array_spec): Likewise.
750 (is_constant_element): Likewise.
751 (gfc_constant_ac): Likewise.
752 * check.cc (dim_rank_check): Likewise.
753 * cpp.cc (gfc_cpp_init_options): Likewise.
754 (dump_macro): Likewise.
755 * cpp.h (gfc_cpp_handle_option): Likewise.
756 * dependency.cc (gfc_ref_needs_temporary_p): Likewise.
757 (gfc_check_argument_dependency): Likewise.
758 (gfc_check_fncall_dependency): Likewise.
759 (ref_same_as_full_array): Likewise.
760 * dependency.h (gfc_check_fncall_dependency): Likewise.
761 (gfc_dep_resolver): Likewise.
762 (gfc_are_equivalenced_arrays): Likewise.
763 * expr.cc (gfc_copy_ref): Likewise.
764 (gfc_kind_max): Likewise.
765 (numeric_type): Likewise.
766 * gfortran.h (gfc_at_end): Likewise.
767 (gfc_at_eof): Likewise.
768 (gfc_at_bol): Likewise.
769 (gfc_at_eol): Likewise.
770 (gfc_define_undef_line): Likewise.
771 (gfc_wide_is_printable): Likewise.
772 (gfc_wide_is_digit): Likewise.
773 (gfc_wide_fits_in_byte): Likewise.
774 (gfc_find_sym_tree): Likewise.
775 (gfc_generic_intrinsic): Likewise.
776 (gfc_specific_intrinsic): Likewise.
777 (gfc_intrinsic_actual_ok): Likewise.
778 (gfc_has_vector_index): Likewise.
779 (gfc_numeric_ts): Likewise.
780 (gfc_impure_variable): Likewise.
781 (gfc_pure): Likewise.
782 (gfc_implicit_pure): Likewise.
783 (gfc_elemental): Likewise.
784 (gfc_pure_function): Likewise.
785 (gfc_implicit_pure_function): Likewise.
786 (gfc_compare_array_spec): Likewise.
787 (gfc_constant_ac): Likewise.
788 (gfc_expanded_ac): Likewise.
789 (gfc_check_digit): Likewise.
790 * intrinsic.cc (gfc_find_subroutine): Likewise.
791 (gfc_generic_intrinsic): Likewise.
792 (gfc_specific_intrinsic): Likewise.
793 * io.cc (compare_to_allowed_values): Likewise. And remove
794 unneeded forward declaration.
795 * parse.cc: Likewise.
796 * parse.h (gfc_check_do_variable): Likewise.
797 * primary.cc (gfc_check_digit): Likewise.
798 * resolve.cc (resolve_structure_cons): Likewise.
799 (pure_stmt_function): Likewise.
800 (gfc_pure_function): Likewise.
801 (impure_stmt_fcn): Likewise.
802 (resolve_forall_iterators): Likewise.
803 (resolve_data): Likewise.
804 (gfc_impure_variable): Likewise.
805 (gfc_pure): Likewise.
806 (gfc_unset_implicit_pure): Likewise.
807 * scanner.cc (wide_is_ascii): Likewise.
808 (gfc_wide_toupper): Likewise.
809 (gfc_open_included_file): Likewise.
810 (gfc_at_end): Likewise.
811 (gfc_at_eof): Likewise.
812 (gfc_at_bol): Likewise.
813 (skip_comment_line): Likewise.
814 (gfc_gobble_whitespace): Likewise.
815 * symbol.cc (gfc_find_symtree_in_proc): Likewise.
816 * trans-array.cc: Likewise.
817 * trans-decl.cc (gfc_set_decl_assembler_name): Likewise.
818 * trans-types.cc (gfc_get_element_type): Likewise.
819 (gfc_add_field_to_struct): Likewise.
820 * trans-types.h (gfc_copy_dt_decls_ifequal): Likewise.
821 (gfc_return_by_reference): Likewise.
822 (gfc_is_nodesc_array): Likewise.
823 * trans.h (gfc_can_put_var_on_stack): Likewise.
825 2023-05-17 Harald Anlauf <anlauf@gmx.de>
829 * decl.cc (add_init_expr_to_sym): Set shape of initializer also for
830 zero-sized arrays, so that bounds violations can be detected later.
832 2023-05-17 Tobias Burnus <tobias@codesourcery.com>
834 * trans-decl.cc (gfc_get_symbol_decl): Add attributes
835 such as 'declare target' also to hidden artificial
836 variable for deferred-length character variables.
837 * trans-openmp.cc (gfc_trans_omp_array_section,
838 gfc_trans_omp_clauses, gfc_trans_omp_target_exit_data):
839 Improve mapping of array descriptors and deferred-length
842 2023-05-16 Paul Thomas <pault@gcc.gnu.org>
850 * interface.cc (gfc_compare_actual_formal): Emit an error if an
851 unlimited polymorphic actual is not matched either to an
852 unlimited or assumed type formal argument.
853 * resolve.cc (resolve_ordinary_assign): Emit an error if the
854 var expression of an ordinary assignment is a proc pointer
856 * trans-array.cc (gfc_walk_array_ref): Provide assumed shape
857 arrays coming from interface mapping with a viable arrayspec.
858 * trans-expr.cc (gfc_conv_intrinsic_to_class): Tidy up flagging
859 of unlimited polymorphic 'class_ts'.
860 (gfc_conv_gfc_desc_to_cfi_desc): Assumed type is unlimited
861 polymorphic and should accept any actual type.
862 (gfc_conv_procedure_call): Replace dreadful kludge with a call
863 to gfc_finalize_tree_expr. Avoid dereferencing a void pointer
864 by giving it the pointer type of the actual argument.
865 (alloc_scalar_allocatable_subcomponent): Shorten the function
866 name and replace the symbol argument with the se string length.
867 If a deferred length character length is either not present or
868 is not a variable, give the typespec a variable and assign the
869 string length to that. Use gfc_deferred_strlen to find the
870 hidden string length component.
871 (gfc_trans_subcomponent_assign): Convert the expression before
872 the call to alloc_scalar_allocatable_subcomponent so that a
873 good string length is provided.
874 (gfc_trans_structure_assign): Remove the unneeded derived type
875 symbol from calls to gfc_trans_subcomponent_assign.
877 2023-05-15 Harald Anlauf <anlauf@gmx.de>
880 * expr.cc (gfc_check_vardef_context): Check appropriate pointer
881 attribute for CLASS vs. non-CLASS function result in variable
884 2023-05-11 Xi Ruoyao <xry111@xry111.site>
886 * Make-lang.in: Use grep instead of fgrep.
888 2023-05-10 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
890 * dump-parse-tree.cc (gfc_debug_expr): Remove forward declaration.
891 (debug): Add DEBUG_FUNCTION.
892 (show_code_node): Remove erroneous whitespace.
894 2023-05-10 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
897 * dump-parse-tree.cc (debug): New function for gfc_namespace.
898 (gfc_debug_code): Delete forward declaration.
899 (show_attr): Make sure to print balanced braces.
901 2023-05-08 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
903 * resolve.cc (resolve_select_type): Fix coding style.
905 2023-05-08 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
907 * resolve.cc (resolve_select_type): Call free() unconditionally.
909 2023-05-08 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
912 * expr.cc (find_array_section): Fix mpz memory leak.
913 * simplify.cc (gfc_simplify_reshape): Fix mpz memory leaks in
916 2023-05-05 Harald Anlauf <anlauf@gmx.de>
919 * arith.cc (eval_intrinsic): Check conformability of ranks of operands
920 for intrinsic binary operators before performing type conversions.
921 * gfortran.h (gfc_op_rank_conformable): Add prototype.
922 * resolve.cc (resolve_operator): Check conformability of ranks of
923 operands for intrinsic binary operators before performing type
925 (gfc_op_rank_conformable): New helper function to compare ranks of
926 operands of binary operator.
928 2023-05-04 Julian Brown <julian@codesourcery.com>
931 * openmp.cc (resolve_omp_clauses): Add diagnostic for
932 non-pointer/non-allocatable attach/detach.
933 * trans-openmp.cc (gfc_trans_omp_clauses): Remove dereference for
934 pointer-to-scalar derived type component attach/detach. Fix
935 attach/detach handling for descriptors.
937 2023-04-28 Julian Brown <julian@codesourcery.com>
940 * trans-openmp.cc (gfc_trans_omp_clauses): Attach/detach clause fixes.
942 2023-04-28 Tobias Burnus <tobias@codesourcery.com>
944 * gfortran.texi: Fix typos.
945 * decl.cc: Fix typos in comments and in a variable name.
946 * arith.cc: Fix comment typos.
947 * check.cc: Likewise.
948 * class.cc: Likewise.
949 * dependency.cc: Likewise.
951 * frontend-passes.cc: Likewise.
952 * gfortran.h: Likewise.
953 * intrinsic.cc: Likewise.
954 * iresolve.cc: Likewise.
955 * match.cc: Likewise.
956 * module.cc: Likewise.
957 * primary.cc: Likewise.
958 * resolve.cc: Likewise.
959 * simplify.cc: Likewise.
960 * trans-array.cc: Likewise.
961 * trans-decl.cc: Likewise.
962 * trans-expr.cc: Likewise.
963 * trans-intrinsic.cc: Likewise.
964 * trans-openmp.cc: Likewise.
965 * trans-stmt.cc: Likewise.
967 2023-04-25 Tobias Burnus <tobias@codesourcery.com>
969 * openmp.cc (gfc_resolve_omp_do_blocks): Handle zero
970 or more than one exec statements before/after 'omp scan'.
971 * trans-openmp.cc (gfc_trans_omp_do): Likewise.
973 2023-04-22 Harald Anlauf <anlauf@gmx.de>
974 Steven G. Kargl <kargl@gcc.gnu.org>
977 * interface.cc (gfc_compare_actual_formal): Reject allocatable
978 functions being used as actual argument for allocable dummy.
980 2023-04-14 Harald Anlauf <anlauf@gmx.de>
983 * simplify.cc (gfc_simplify_set_exponent): Fix implementation of
984 compile-time simplification of intrinsic SET_EXPONENT for argument
987 2023-04-14 Paul Thomas <pault@gcc.gnu.org>
990 * gfortran.h : Add expr3_not_explicit bit field to gfc_code.
991 * resolve.cc (resolve_allocate_expr): Set bit field when the
992 default initializer is applied to expr3.
993 * trans-stmt.cc (gfc_trans_allocate): If expr3_not_explicit is
994 set, do not deallocate expr3.
996 2023-04-13 Harald Anlauf <anlauf@gmx.de>
999 * trans-expr.cc (gfc_conv_power_op): Use absu_hwi and
1000 unsigned HOST_WIDE_INT for portability.
1002 2023-04-12 Harald Anlauf <anlauf@gmx.de>
1005 * resolve.cc (resolve_entries): Handle functions with ENTRY and
1006 ALLOCATABLE results.
1007 * trans-expr.cc (gfc_conv_procedure_call): Functions with a result
1008 with the POINTER or ALLOCATABLE attribute shall not get any special
1009 treatment with -ff2c, as they cannot be written in Fortran 77.
1010 * trans-types.cc (gfc_return_by_reference): Likewise.
1011 (gfc_get_function_type): Likewise.
1013 2023-04-12 Harald Anlauf <anlauf@gmx.de>
1017 * interface.cc (compare_parameter): Enable type and rank checks for
1018 arguments of derived type from the intrinsic module ISO_C_BINDING.
1020 2023-04-08 Paul Thomas <pault@gcc.gnu.org>
1023 * iresolve.cc (gfc_resolve_adjustl, gfc_resolve_adjustr): if
1024 string length is deferred use the string typespec for result.
1025 * resolve.cc (resolve_assoc_var): Handle parentheses around the
1027 (resolve_block_construct): Remove unnecessary static decls.
1028 * trans-array.cc (gfc_conv_expr_descriptor): Guard string len
1029 expression in condition. Improve handling of string length and
1030 span, especially for substrings of the descriptor.
1031 (duplicate_allocatable): Make element type more explicit with
1033 * trans-decl.cc (gfc_get_symbol_decl): Emit a fatal error with
1034 appropriate message instead of ICE if symbol type is unknown.
1035 (gfc_generate_function_code): Set current locus to proc_sym
1037 * trans-expr.cc (gfc_get_expr_charlen): Retain last charlen in
1038 'previous' and use if end expression in substring reference is
1040 (gfc_conv_string_length): Use gfc_conv_expr_descriptor if
1041 'expr_flat' is an array. Add post block to catch deallocation
1043 (gfc_conv_procedure_call): Assign the parmse string length to
1044 the expression string length, if it is deferred.
1045 (gfc_trans_alloc_subarray_assign): If this is a deferred string
1046 length component, store the string length in the hidden comp.
1047 Update the typespec length accordingly. Generate a new type
1048 spec for the call to gfc_duplicate-allocatable in this case.
1049 * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
1050 deferred character array components.
1052 2023-04-04 Harald Anlauf <anlauf@gmx.de>
1055 * expr.cc (check_restricted): Adjust check for valid variables in
1056 restricted expressions: make no exception for module variables.
1058 2023-04-01 Thomas Koenig <tkoenig@gcc.gnu.org>
1060 * dump-parse-tree.cc (get_c_type_name): Fix "long_long"
1061 type name to be "long long".
1063 2023-03-30 Andrew Pinski <apinski@marvell.com>
1065 * dump-parse-tree.cc (get_c_type_name): Fix "long_long"
1066 type name to be "long long". Add a comment on why adding
1069 2023-03-28 Jakub Jelinek <jakub@redhat.com>
1072 * openmp.cc (gfc_omp_absent_contains_clause): Fix typo in diagnostics
1073 - composit -> composite.
1075 2023-03-25 Harald Anlauf <anlauf@gmx.de>
1078 * trans-decl.cc (gfc_conv_cfi_to_gfc): Remove dead code.
1080 2023-03-24 Harald Anlauf <anlauf@gmx.de>
1082 * expr.cc (free_expr0): Free also BOZ strings as part of an expression.
1084 2023-03-24 Haochen Gui <guihaoc@gcc.gnu.org>
1085 Tobias Burnus <tobias@codesourcery.com>
1088 * target-memory.cc (gfc_interpret_float): Return FAIL when
1089 native_interpret_expr gets a NULL tree.
1090 * arith.cc (gfc_hollerith2real): Return NULL when
1091 gfc_interpret_float fails.
1092 * error.cc (gfc_buffered_p): Define.
1093 * gfortran.h (gfc_buffered_p): Declare.
1094 * intrinsic.cc: Add diagnostic.h to include list.
1095 (do_simplify): Save errorcount and check it at finish. Report a
1096 "Cannot simplify expression" error on a bad result if error count
1097 doesn't change and no other errors buffered.
1099 2023-03-22 Harald Anlauf <anlauf@gmx.de>
1100 Steven G. Kargl <kargl@gcc.gnu.org>
1103 * resolve.cc (gfc_resolve_finalizers): Argument of a FINAL subroutine
1104 cannot be an alternate return.
1106 2023-03-21 Harald Anlauf <anlauf@gmx.de>
1109 * decl.cc (gfc_match_modproc): Reject MODULE PROCEDURE if not in a
1110 generic module interface.
1112 2023-03-21 Arsen Arsenović <arsen@aarsen.me>
1114 * invoke.texi: Remove usages of @gol.
1115 * intrinsic.texi: Ditto.
1117 2023-03-21 Paul Thomas <pault@gcc.gnu.org>
1120 * trans-array.cc (gfc_trans_array_constructor_value): Correct
1121 incorrect setting of typespec.
1123 2023-03-21 Paul Thomas <pault@gcc.gnu.org>
1126 * resolve.cc (generate_component_assignments): Restore the
1127 exclusion of allocatable components from the loop.
1129 2023-03-20 Harald Anlauf <anlauf@gmx.de>
1132 * invoke.texi: Correct documentation of how underscores are appended
1135 2023-03-20 Harald Anlauf <anlauf@gmx.de>
1138 * simplify.cc (gfc_simplify_nearest): Fix off-by-one error in setting
1139 up real kind-specific maximum exponent for mpfr.
1141 2023-03-20 Paul Thomas <pault@gcc.gnu.org>
1144 * resolve.cc (check_host_association): If an external function
1145 is typed but not declared explicitly to be external, change the
1146 old symbol from a variable to an external function.
1148 2023-03-19 Harald Anlauf <anlauf@gmx.de>
1151 * resolve.cc (resolve_fl_procedure): Check for an explicit interface
1152 of procedures with the BIND(C) attribute (F2018:15.4.2.2).
1154 2023-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
1156 * gfortran.texi: Mention behavior on overflow.
1158 2023-03-18 Paul Thomas <pault@gcc.gnu.org>
1163 * class.cc (finalize_component): Include the missing arguments
1164 in the call to the component's finalizer wrapper.
1165 (has_finalizer_component): Do not return true for procedure
1167 (finalizer_insert_packed_call): Remove the redundant argument
1168 in the call to the final subroutine.
1169 (generate_finalization_wrapper): Add support for assumed rank
1171 (gfc_may_be_finalized): New helper function.
1172 * dump-parse-tree.cc (write_proc): Whitespace.
1173 * gfortran.h : Add prototype for gfc_may_be_finalized.
1174 * resolve.cc (resolve_function): Correct derived types that
1175 have an incomplete namespace.
1176 (resolve_where, gfc_resolve_where_code_in_forall,
1177 gfc_resolve_forall_body, gfc_resolve_code): Check that the op
1178 code is still EXEC_ASSIGN. If it is set lhs to must finalize.
1179 (is_finalizable_type): New function.
1180 (generate_component_assignments): Set must_finalize if needed.
1181 (gfc_resolve_finalizers): Error if assumed rank finalizer is
1182 not the only one. Warning on lack of scalar finalizer modified
1183 to account for assumed rank finalizers.
1184 (generate_final_call): New function.
1185 (generate_component_assignments): Enclose the outermost call in
1186 a block to capture automatic deallocation and final calls.
1187 Set must_finalize as required to satisfy the standards. Use an
1188 explicit pointer assignment for pointer components to capture
1189 finalization of the target. Likewise use explicit assignment
1190 for allocatable components. Do not use the temporary copy of
1191 the lhs in defined assignment if the component is allocatable.
1192 Put the temporary in the same namespace as the lhs symbol if
1193 the component may be finalized. Remove the leading assignment
1194 from the expansion of assignment of components that have their
1195 own defined assignment components. Suppress finalization of
1196 assignment of temporary components to the lhs. Make an explicit
1197 final call for the rhs function temporary if it exists.
1198 (gfc_resolve_code): Set must_finalize for assignments with an
1199 array constructor on the rhs.
1200 (gfc_resolve_finalizers): Ensure that an assumed rank finalizer
1201 is the only finalizer for that type and correct the surprising
1202 warning for the lack of a scalar finalizer.
1203 (check_defined_assignments): Handle allocatable components.
1204 (resolve_fl_derived): Set referenced the vtab for use
1206 (resolve_symbol): Set referenced an unreferenced symbol that
1208 * trans-array.cc (gfc_trans_array_constructor_value): Add code
1209 to finalize the constructor result. Warn that this feature was
1210 removed in F2018 and that it is suppressed by -std=2018.
1211 (trans_array_constructor): Add finalblock, pass to previous
1212 and apply to loop->post if filled.
1213 (gfc_add_loop_ss_code): Add se finalblock to outer loop post.
1214 (gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
1215 generated finalization code to the main block.
1216 (structure_alloc_comps): Add boolean argument to suppress
1217 finalization and use it for calls from
1218 gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
1220 (gfc_copy_alloc_comp_no_fini): New wrapper for
1221 structure_alloc_comps.
1222 (gfc_alloc_allocatable_for_assignment): Suppress finalization
1223 by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
1224 (gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
1225 deallocate the components of entities with a leading '_' in the
1226 name that are also marked as artificial.
1227 * trans-array.h : Add the new boolean argument to the prototype
1228 of gfc_deallocate_alloc_comp_no_caf with a default of false.
1229 Add prototype for gfc_copy_alloc_comp_no_fini.
1230 * trans-decl.cc(init_intent_out_dt): Tidy up the code.
1231 * trans-expr.cc (gfc_init_se): Initialize finalblock.
1232 (gfc_conv_procedure_call): Use gfc_finalize_tree_expr to
1233 finalize function results. Replace in-line block for class
1234 results with call to new function.
1235 (gfc_conv_expr): Finalize structure constructors for F2003 and
1236 F2008. Warn that this feature was deleted in F2018 and, unlike
1237 array constructors, is not default. Add array constructor
1238 finalblock to the post block.
1239 (gfc_trans_scalar_assign): Suppress finalization by setting new
1240 argument in call to gfc_deallocate_alloc_comp_no_caf. Add the
1241 finalization blocks to the main block.
1242 (gfc_trans_arrayfunc_assign): Use gfc_assignment_finalizer_call
1243 and ensure that finalization occurs after the evaluation of the
1244 rhs but using the initial value for the lhs. Finalize rhs
1245 function results using gfc_finalize_tree_expr.
1246 (trans_class_assignment, gfc_trans_assignment_1): As previous
1247 function, taking care to order evaluation, assignment and
1248 finalization correctly.
1249 * trans-io.cc (gfc_trans_transfer): Add the final block.
1250 * trans-stmt.cc (gfc_trans_call, gfc_trans_allocate): likewise.
1251 (trans_associate_var): Nullify derived allocatable components
1252 and finalize function targets with defined assignment
1253 components on leaving the block scope.
1254 (trans_allocate): Finalize source expressions, if required,
1255 and set init_expr artificial temporarily to suppress the
1256 finalization in gfc_trans_assignment.
1257 * trans.cc (gfc_add_finalizer_call): Do not finalize the
1258 temporaries generated in type assignment with defined
1259 assignment components.
1260 (gfc_assignment_finalizer_call): New function.
1261 (gfc_finalize_tree_expr): New function.
1262 * trans.h: Add finalblock to gfc_se. Add the prototypes for
1263 gfc_finalize_tree_expr and gfc_assignment_finalizer_call.
1265 2023-03-15 Harald Anlauf <anlauf@gmx.de>
1266 Tobias Burnus <tobias@codesourcery.com>
1269 * interface.cc (compare_parameter): Adjust check of array dummy
1270 arguments to handle the case of CLASS variables.
1272 2023-03-11 Harald Anlauf <anlauf@gmx.de>
1275 * trans-expr.cc (gfc_copy_class_to_class): Convert element counts in
1276 bounds check to common type for comparison.
1278 2023-03-10 Harald Anlauf <anlauf@gmx.de>
1281 * resolve.cc (resolve_symbol): Avoid NULL pointer dereference while
1282 checking a symbol with the BIND(C) attribute.
1284 2023-03-05 Harald Anlauf <anlauf@gmx.de>
1285 Tobias Burnus <tobias@codesourcery.com>
1288 * class.cc (gfc_build_class_symbol): Handle update of attributes of
1289 existing class container.
1290 (gfc_find_derived_vtab): Fix several memory leaks.
1291 (find_intrinsic_vtab): Ditto.
1292 * decl.cc (attr_decl1): Manage update of symbol attributes from
1294 * primary.cc (gfc_variable_attr): OPTIONAL shall not be taken or
1295 updated from the class container.
1296 * symbol.cc (free_old_symbol): Adjust management of symbol versions
1297 to not prematurely free array specs while working on the declation
1300 2023-03-01 Tobias Burnus <tobias@codesourcery.com>
1302 PR middle-end/108546
1303 * trans-openmp.cc (gfc_trans_omp_clauses): Fix mapping of
1304 type(C_ptr) variables.
1306 2023-02-27 Harald Anlauf <anlauf@gmx.de>
1309 * trans-intrinsic.cc (gfc_conv_intrinsic_ibits): Handle corner case
1310 LEN argument of IBITS equal to BITSIZE(I).
1312 2023-02-25 Mikael Morin <mikael@gcc.gnu.org>
1315 * intrinsic.cc (get_intrinsic_dummy_arg,
1316 set_intrinsic_dummy_arg): Rename the former to the latter.
1317 Remove the return value, add a reference to the lhs as argument,
1318 and do the pointer assignment inside the function. Don't do
1319 it if the pointer is already non-NULL.
1320 (sort_actual): Update caller.
1322 2023-02-25 Harald Anlauf <anlauf@gmx.de>
1324 * arith.cc (gfc_real2int): Clear mpfr variable after use.
1326 2023-02-25 Tobias Burnus <tobias@codesourcery.com>
1329 * trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Skip setting of
1330 bounds of CFI desc for 'pointer,intent(out)'.
1332 2023-02-24 Rimvydas Jasinskas <rimvydas.jas@gmail.com>
1334 * trans-decl.cc (gfc_finish_var_decl): Apply attribute.
1335 (generate_local_decl): Add diagnostic for dummy and local variables.
1337 2023-02-24 Mikael Morin <mikael@gcc.gnu.org>
1340 * expr.cc (gfc_free_actual_arglist): Free associated_dummy
1342 (gfc_copy_actual_arglist): Make a copy of the associated_dummy
1343 field if it is set in the original element.
1345 2023-02-24 Harald Anlauf <anlauf@gmx.de>
1348 * frontend-passes.cc (do_subscript): Clear used gmp variable.
1350 2023-02-23 Arsen Arsenović <arsen@aarsen.me>
1352 * invoke.texi: Reorder index entries around @items.
1354 2023-02-23 Arsen Arsenović <arsen@aarsen.me>
1356 * invoke.texi: Reorder @opindex commands to precede @items they
1359 2023-02-22 Harald Anlauf <anlauf@gmx.de>
1362 * resolve.cc (resolve_component): The type of a CHARACTER length
1363 expression must be INTEGER.
1365 2023-02-21 Harald Anlauf <anlauf@gmx.de>
1368 * parse.cc (check_function_result_typed): Improve type check of
1369 specification expression for character length and return status.
1370 (parse_spec): Use status from above.
1371 * resolve.cc (resolve_fntype): Prevent use of invalid specification
1372 expression for character length.
1374 2023-02-16 Patrick Palka <ppalka@redhat.com>
1376 * gfortran.h: Mechanically drop static from static inline
1377 functions via s/^static inline/inline/g.
1379 2023-02-15 Steve Kargl <kargl@gcc.gnu.org>
1382 * frontend-passes.cc (do_intent): Catch NULL pointer dereference on
1383 reference to invalid formal argument.
1385 2023-02-15 Steve Kargl <kargl@gcc.gnu.org>
1388 * resolve.cc (check_assumed_size_reference): Avoid NULL pointer
1391 2023-02-15 Tobias Burnus <tobias@codesourcery.com>
1394 * openmp.cc (gfc_resolve_omp_parallel_blocks): Handle combined 'loop'
1396 (gfc_resolve_do_iterator): Set a source location for added
1397 'private'-clause arguments.
1398 * resolve.cc (gfc_resolve_code): Call gfc_resolve_omp_do_blocks
1399 also for EXEC_OMP_LOOP and gfc_resolve_omp_parallel_blocks for
1400 combined directives with loop + '{masked,master} taskloop (simd)'.
1402 2023-02-13 Harald Anlauf <anlauf@gmx.de>
1405 * primary.cc (gfc_expr_attr): Avoid NULL pointer dereference for
1406 invalid use of CLASS variable.
1408 2023-02-13 Rimvydas Jasinskas <rimvydas.jas@gmail.com>
1410 * decl.cc: Add EXT_ATTR_NOINLINE, EXT_ATTR_NORETURN, EXT_ATTR_WEAK.
1411 * gfortran.h (ext_attr_id_t): Ditto.
1412 * gfortran.texi (GCC$ ATTRIBUTES): Document them.
1413 * trans-decl.cc (build_function_decl): Apply them.
1415 2023-02-09 Harald Anlauf <anlauf@gmx.de>
1416 Steven G. Kargl <kargl@gcc.gnu.org>
1420 * intrinsic.cc (gfc_convert_chartype): Recover on invalid character
1421 kind in conversion instead of generating an internal error.
1423 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
1426 * trans-openmp.cc (struct dovar_init_d): Add 'sym' and
1427 'non_unit_incr' members.
1428 (gfc_nonrect_loop_expr): New.
1429 (gfc_trans_omp_do): Call it; use normal loop bounds
1430 for unit stride - and only create local loop var.
1432 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
1434 * parse.cc (decode_omp_directive): Really ignore 'assumes' with
1437 2023-02-08 Steve Kargl <kargl@gcc.gnu.org>
1440 * resolve.cc (resolve_common_vars): Avoid NULL pointer dereference
1441 when a symbol's location is not set.
1443 2023-02-07 Harald Anlauf <anlauf@gmx.de>
1446 * trans-decl.cc (gfc_finish_var_decl): With -fno-automatic, do not
1447 make ASSOCIATE variables TREE_STATIC.
1449 2023-02-05 Harald Anlauf <anlauf@gmx.de>
1452 * arith.cc (gfc_arith_divide): Emit integer division truncation
1453 warnings using gfc_warning instead of gfc_warning_now to prevent
1456 2023-02-03 Jakub Jelinek <jakub@redhat.com>
1459 * trans-decl.cc (gfc_trans_use_stmts): Call clear_slot before
1462 2023-02-01 Harald Anlauf <anlauf@gmx.de>
1465 * expr.cc (find_array_section): Add check to prevent interpreting an
1466 mpz non-integer constant as an integer.
1468 2023-02-01 Tobias Burnus <tobias@codesourcery.com>
1470 * openmp.cc (resolve_omp_clauses): Check also for
1473 2023-01-29 Mikael Morin <mikael@gcc.gnu.org>
1476 * check.cc (gfc_check_minloc_maxloc): Explicitly set argument name.
1477 (gfc_check_findloc): Ditto.
1479 2023-01-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
1482 * parse.cc (parse_module): Remove use of a bool error value
1483 that prevented proper setting of the namespace pointer.
1485 2023-01-28 Harald Anlauf <anlauf@gmx.de>
1486 Steven G. Kargl <kargl@gcc.gnu.org>
1489 * resolve.cc (compare_bound_int): Expression to compare must be of
1491 (compare_bound_mpz_t): Likewise.
1492 (check_dimension): Fix comment on checks applied to array section
1493 and clean up associated logic.
1495 2023-01-28 Harald Anlauf <anlauf@gmx.de>
1498 * match.cc (gfc_match_common): A USE associated name shall not appear
1499 in a COMMON block (F2018:C8121).
1501 2023-01-27 Tobias Burnus <tobias@codesourcery.com>
1504 * trans-openmp.cc (gfc_split_omp_clauses): Handle has_device_addr.
1506 2023-01-26 Harald Anlauf <anlauf@gmx.de>
1509 * resolve.cc (check_host_association): Extend host association check
1510 so that it is not restricted to functions. Also prevent NULL pointer
1513 2023-01-25 Steve Kargl <kargl@gcc.gnu.org>
1516 * array.cc (compare_bounds): Return false instead of generating an
1517 internal error on an invalid argument type.
1519 2023-01-24 Harald Anlauf <anlauf@gmx.de>
1522 * simplify.cc (simplify_transformation): Do not try to simplify
1523 transformational intrinsic when the ARRAY argument has a NULL shape.
1525 2023-01-23 Harald Anlauf <anlauf@gmx.de>
1528 * dependency.cc (gfc_check_dependency): Prevent NULL pointer
1529 dereference while recursively checking expressions.
1531 2023-01-23 Harald Anlauf <anlauf@gmx.de>
1534 * interface.cc (get_expr_storage_size): Check array subscript triplets
1535 that we actually have integer values before trying to extract with
1538 2023-01-23 Harald Anlauf <anlauf@gmx.de>
1541 * iresolve.cc (check_charlen_present): Preserve character length if
1542 there is no array constructor.
1544 2023-01-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
1547 * data.cc (gfc_assign_data_value): Remove check for PARAMETER in DATA.
1548 * primary.cc (match_variable): Add check for PARAMETER in DATA.
1550 2023-01-19 Harald Anlauf <anlauf@gmx.de>
1553 * expr.cc (class_allocatable): Prevent NULL pointer dereference
1555 (class_pointer): Likewise.
1557 2023-01-17 Harald Anlauf <anlauf@gmx.de>
1560 * interface.cc (get_expr_storage_size): Check that we actually have
1561 an integer value before trying to extract it with mpz_get_si.
1563 2023-01-12 Tobias Burnus <tobias@codesourcery.com>
1566 * openmp.cc (gfc_resolve_omp_assumptions): Reject nonscalars.
1568 2023-01-11 Jakub Jelinek <jakub@redhat.com>
1571 * f95-lang.cc (gfc_init_builtin_function): Fix up function types
1572 for BUILT_IN_REALLOC and BUILT_IN_SINCOS{F,,L}. Formatting fixes.
1574 2023-01-10 Harald Anlauf <anlauf@gmx.de>
1577 * frontend-passes.cc (do_subscript): Clear used gmp variables.
1579 2023-01-02 Jakub Jelinek <jakub@redhat.com>
1581 * gfortranspec.cc (lang_specific_driver): Update copyright notice
1583 * gfc-internals.texi: Bump @copying's copyright year.
1584 * gfortran.texi: Ditto.
1585 * intrinsic.texi: Ditto.
1586 * invoke.texi: Ditto.
1589 Copyright (C) 2023 Free Software Foundation, Inc.
1591 Copying and distribution of this file, with or without modification,
1592 are permitted in any medium without royalty provided the copyright
1593 notice and this notice are preserved.