Daily bump.
[official-gcc.git] / gcc / fortran / ChangeLog
blob221fc63db63b55f45627f7a0bd1c94f0d2393b5d
1 2024-03-28  Harald Anlauf  <anlauf@gmx.de>
3         PR fortran/114474
4         * primary.cc (gfc_variable_attr): Catch variables used in structure
5         constructors within DATA statements that are still tagged with a
6         temporary type BT_PROCEDURE from match_actual_arg and which have the
7         target attribute, and fix their typespec.
9 2024-03-28  Mikael Morin  <mikael@gcc.gnu.org>
10             Harald Anlauf  <anlauf@gmx.de>
12         PR fortran/111781
13         PR fortran/114475
14         * expr.cc (check_restricted): In submodules, allow variables host-
15         associated from the parent module.
17 2024-03-22  Harald Anlauf  <anlauf@gmx.de>
19         PR fortran/55978
20         * interface.cc (gfc_compare_actual_formal): Skip size check for
21         NULL() actual without MOLD argument.
23 2024-03-22  Mikael Morin  <mikael@gcc.gnu.org>
25         PR fortran/107426
26         * gfortran.h (gfc_save_module_list, gfc_restore_old_module_list):
27         New declarations.
28         * module.cc (old_module_list_tail): New global variable.
29         (gfc_save_module_list, gfc_restore_old_module_list): New functions.
30         (gfc_use_modules): Set module_list and old_module_list_tail.
31         * parse.cc (next_statement): Save module_list before doing any work.
32         (reject_statement): Restore module_list to its saved value.
34 2024-03-22  Mikael Morin  <mikael@gcc.gnu.org>
36         PR fortran/111781
37         * symbol.cc (gfc_get_procedure_ns, gfc_get_spec_ns): New functions.
38         * gfortran.h (gfc_get_procedure_ns, gfc_get_spec ns): Declare them.
39         (gfc_is_formal_arg): Remove.
40         * expr.cc (check_restricted): Remove special case allowing local
41         variable in dummy argument bound expressions.  Use gfc_get_spec_ns
42         to get the right namespace.
43         * resolve.cc (gfc_is_formal_arg, formal_arg_flag): Remove.
44         (gfc_resolve_formal_arglist): Set gfc_current_ns.  Quit loop and
45         restore gfc_current_ns instead of early returning.
46         (resolve_symbol): Factor common array spec resolution code to...
47         (resolve_symbol_array_spec): ... this new function.  Additionnally
48         set and restore gfc_current_ns.
50 2024-03-21  Harald Anlauf  <anlauf@gmx.de>
52         PR fortran/30802
53         * trans-array.cc (abridged_ref_name): New helper function.
54         (trans_array_bound_check): Use it.
55         (array_bound_check_elemental): Likewise.
56         (gfc_conv_array_ref): Likewise.
58 2024-03-20  Jakub Jelinek  <jakub@redhat.com>
60         * trans-array.cc (structure_alloc_comps): Use integer_zero_node
61         instead of build_zero_cst (integer_type_node) or
62         build_int_cst (integer_type_node, 0) and integer_one_node instead of
63         build_int_cst (integer_type_node, 1).
64         * trans-expr.cc (conv_scalar_char_value): Likewise.
65         * trans-stmt.cc (gfc_trans_form_team, gfc_trans_change_team,
66         gfc_trans_sync_team, gfc_trans_sync): Likewise.
67         * trans-decl.cc (create_main_function): Likewise.
68         * trans-intrinsic.cc (trans_this_image, conv_intrinsic_move_alloc):
69         Likewise.
70         * trans.cc (gfc_allocate_using_caf_lib, gfc_deallocate_with_status):
71         Likewise.
73 2024-03-18  Harald Anlauf  <anlauf@gmx.de>
75         PR fortran/103715
76         * frontend-passes.cc (check_externals_expr): Prevent invalid read
77         in case of mismatch of external subroutine with function.
79 2024-03-17  Harald Anlauf  <anlauf@gmx.de>
81         PR fortran/101135
82         * trans-array.cc (gfc_get_dataptr_offset): Check for optional
83         arguments being present before dereferencing data pointer.
85 2024-03-15  Paul Thomas  <pault@gcc.gnu.org>
87         PR fortran/87477
88         PR fortran/89645
89         PR fortran/99065
90         PR fortran/114141
91         PR fortran/114280
92         * class.cc (gfc_change_class): New function needed for
93         associate names, when rank changes or a derived type is
94         produced by resolution
95         * dump-parse-tree.cc (show_code_node): Make output for SELECT
96         TYPE more comprehensible.
97         * expr.cc (find_inquiry_ref): Do not simplify expressions of
98         an inferred type.
99         * gfortran.h : Add 'gfc_association_list' to structure
100         'gfc_association_list'. Add prototypes for
101         'gfc_find_derived_types', 'gfc_fixup_inferred_type_refs' and
102         'gfc_change_class'. Add macro IS_INFERRED_TYPE.
103         * match.cc (copy_ts_from_selector_to_associate): Add bolean arg
104         'select_type' with default false. If this is a select type name
105         and the selector is a inferred type, build the class type and
106         apply it to the associate name.
107         (build_associate_name): Pass true to 'select_type' in call to
108         previous.
109         * parse.cc (parse_associate): If the selector is inferred type
110         the associate name is too. Make sure that function selector
111         class and rank, if known, are passed to the associate name. If
112         a function result exists, pass its typespec to the associate
113         name.
114         * primary.cc (resolvable_fcns): New function to check that all
115         the function references are resolvable.
116         (gfc_match_varspec): If a scalar derived type select type
117         temporary has an array reference, match the array reference,
118         treating this in the same way as an equivalence member. Do not
119         set 'inquiry' if applied to an unknown type the inquiry name
120         is ambiguous with the component of an accessible derived type.
121         Check that resolution of the target expression is OK by testing
122         if the symbol is declared or is an operator expression, then
123         using 'resolvable_fcns' recursively. If all is well, resolve
124         the expression. If this is an inferred type with a component
125         reference, call 'gfc_find_derived_types' to find a suitable
126         derived type. If there is an inquiry ref and the symbol either
127         is of unknown type or is inferred to be a derived type, set the
128         primary and symbol TKR appropriately.
129         * resolve.cc (resolve_variable): Call new function below.
130         (gfc_fixup_inferred_type_refs): New function to ensure that the
131         expression references for a inferred type are consistent with
132         the now fixed up selector.
133         (resolve_assoc_var): Ensure that derived type or class function
134         selectors transmit the correct arrayspec to the associate name.
135         (resolve_select_type): If the selector is an associate name of
136         inferred type and has no component references, the associate
137         name should have its typespec. Simplify the conversion of a
138         class array to class scalar by calling 'gfc_change_class'.
139         Make sure that a class, inferred type selector with an array
140         ref transfers the typespec from the symbol to the expression.
141         * symbol.cc (gfc_set_default_type): If an associate name with
142         unknown type has a selector expression, try resolving the expr.
143         (find_derived_types, gfc_find_derived_types): New functions
144         that search for a derived type with a given name.
145         * trans-expr.cc (gfc_conv_variable): Some inferred type exprs
146         escape resolution so call 'gfc_fixup_inferred_type_refs'.
147         * trans-stmt.cc (trans_associate_var): Tidy up expression for
148         'class_target'. Finalize and free class function results.
149         Correctly handle selectors that are class functions and class
150         array references, passed as derived types.
152 2024-03-14  Thomas Schwinge  <thomas@codesourcery.com>
154         * dump-parse-tree.cc (show_omp_clauses): Handle 'self_expr'.
155         * openmp.cc (gfc_free_omp_clauses): Likewise.
156         * trans-openmp.cc (gfc_split_omp_clauses): Don't handle 'self_expr'.
158 2024-03-14  Chung-Lin Tang  <cltang@baylibre.com>
160         * dump-parse-tree.cc (show_omp_namelist): Print "readonly," for
161         OMP_LIST_MAP and OMP_LIST_CACHE if n->u.map.readonly is set.
162         Adjust 'n->u.map_op' to 'n->u.map.op'.
163         * gfortran.h (typedef struct gfc_omp_namelist): Adjust map_op as
164         'ENUM_BITFIELD (gfc_omp_map_op) op:8', add 'bool readonly' field,
165         change to named struct field 'map'.
166         * openmp.cc (gfc_match_omp_map_clause): Adjust 'n->u.map_op' to
167         'n->u.map.op'.
168         (gfc_match_omp_clause_reduction): Likewise.
169         (gfc_match_omp_clauses): Add readonly modifier parsing for OpenACC
170         copyin clause, set 'n->u.map.op' and 'n->u.map.readonly' for parsed
171         clause. Adjust 'n->u.map_op' to 'n->u.map.op'.
172         (gfc_match_oacc_declare): Adjust 'n->u.map_op' to 'n->u.map.op'.
173         (gfc_match_oacc_cache): Add readonly modifier parsing for OpenACC
174         cache directive.
175         (resolve_omp_clauses): Adjust 'n->u.map_op' to 'n->u.map.op'.
176         * trans-decl.cc (add_clause): Adjust 'n->u.map_op' to 'n->u.map.op'.
177         (finish_oacc_declare): Likewise.
178         * trans-openmp.cc (gfc_trans_omp_clauses): Set OMP_CLAUSE_MAP_READONLY,
179         OMP_CLAUSE__CACHE__READONLY to 1 when readonly is set. Adjust
180         'n->u.map_op' to 'n->u.map.op'.
181         (gfc_add_clause_implicitly): Adjust 'n->u.map_op' to 'n->u.map.op'.
183 2024-03-13  Harald Anlauf  <anlauf@gmx.de>
185         PR fortran/114001
186         * expr.cc (gfc_is_simply_contiguous): Adjust logic so that CLASS
187         symbols are also handled.
189 2024-03-13  Tobias Burnus  <tburnus@baylibre.com>
191         PR fortran/114283
192         * trans-openmp.cc (gfc_omp_predetermined_mapping): Map dummy
193         procedures as firstprivate.
195 2024-03-12  Harald Anlauf  <anlauf@gmx.de>
197         PR fortran/110826
198         * array.cc (gfc_array_dimen_size): When walking the ref chain of an
199         array and the ultimate component is a procedure pointer, do not try
200         to figure out its dimension even if it is a array-valued function.
202 2024-03-06  Harald Anlauf  <anlauf@gmx.de>
204         PR fortran/103707
205         PR fortran/106987
206         * arith.cc (is_hard_arith_error): New helper function to determine
207         whether an arithmetic error is "hard" or not.
208         (check_result): Use it.
209         (gfc_arith_divide): Set "Division by zero" only for regular
210         numerators of real and complex divisions.
211         (reduce_unary): Use is_hard_arith_error to determine whether a hard
212         or (recoverable) soft error was encountered.  Terminate immediately
213         on hard error, otherwise remember code of first soft error.
214         (reduce_binary_ac): Likewise.
215         (reduce_binary_ca): Likewise.
216         (reduce_binary_aa): Likewise.
218 2024-03-01  Harald Anlauf  <anlauf@gmx.de>
220         PR fortran/104819
221         * check.cc (gfc_check_null): Handle nested NULL()s.
222         (is_c_interoperable): Check for MOLD argument of NULL() as part of
223         the interoperability check.
224         * interface.cc (gfc_compare_actual_formal): Extend checks for NULL()
225         actual arguments for presence of MOLD argument when required by
226         Interp J3/22-146.
228 2024-02-29  Alexander Westbrooks  <alexanderw@gcc.gnu.org>
230         PR fortran/82943
231         PR fortran/86148
232         PR fortran/86268
233         * decl.cc (gfc_get_pdt_instance): Set the PDT instance field
234         'f2k_derived', if not set already, to point to the given
235         PDT template 'f2k_derived' namespace in order to give the
236         PDT instance referential access to the typebound procedures
237         of the template.
238         * gfortran.h (gfc_pdt_is_instance_of): Add prototype.
239         * resolve.cc (resolve_typebound_procedure): If the derived type
240         does not have the attribute 'pdt_template' set, compare the
241         dummy argument to the 'resolve_bindings_derived' type like usual.
242         If the derived type is a 'pdt_template', then check if the
243         dummy argument is an instance of the PDT template. If the derived
244         type is a PDT template, and the dummy argument is an instance of
245         that template, but the dummy argument 'param_list' is not
246         SPEC_ASSUMED, check if there are any LEN parameters in the
247         dummy argument. If there are no LEN parameters, then this implies
248         that there are only KIND parameters in the dummy argument.
249         If there are LEN parameters, this would be an error, for all
250         LEN parameters for the dummy argument MUST be assumed for
251         typebound procedures of PDTs.
252         (resolve_pdt): Add a check for ALLOCATABLE and POINTER attributes for
253         SPEC_DEFERRED parameters of PDT class symbols.  ALLOCATABLE and
254         POINTER attributes for a PDT class symbol are stored in the
255         'class_pointer' and 'allocatable' attributes of the '_data'
256         component respectively.
257         * symbol.cc (gfc_pdt_is_instance_of): New function.
259 2024-02-26  Harald Anlauf  <anlauf@gmx.de>
261         PR fortran/114012
262         * trans-expr.cc (gfc_conv_procedure_call): Evaluate non-trivial
263         arguments just once before assigning to an unlimited polymorphic
264         dummy variable.
266 2024-02-23  Steve Kargl  <kargl@gcc.gnu.org>
267             Harald Anlauf  <anlauf@gmx.de>
269         PR fortran/114024
270         * trans-stmt.cc (gfc_trans_allocate): When a source expression has
271         substring references, part-refs, or %re/%im inquiries, wrap the
272         entity in parentheses to force evaluation of the expression.
274 2024-02-23  Tobias Burnus  <tburnus@baylibre.com>
276         * openmp.cc (gfc_match_omp_depobj): Use OPT_Wopenmp
277         as warning category in gfc_warning.
279 2024-02-20  Peter Hill  <peter.hill@york.ac.uk>
281         PR fortran/105658
282         * trans-expr.cc (gfc_conv_intrinsic_to_class): When passing an
283         array component reference of intrinsic type to a procedure
284         with an unlimited polymorphic dummy argument, a temporary
285         should be created.
287 2024-02-17  Jakub Jelinek  <jakub@redhat.com>
289         PR fortran/113503
290         * trans-expr.cc (alloc_scalar_allocatable_subcomponent): Don't
291         overwrite expr2->ts.u.cl->backend_decl, instead set size to
292         expr2->ts.u.cl->backend_decl first and use size instead of
293         expr2->ts.u.cl->backend_decl.
294         (gfc_trans_subcomponent_assign): Emit se.pre into block
295         before calling alloc_scalar_allocatable_subcomponent instead of
296         after it.
298 2024-02-17  Harald Anlauf  <anlauf@gmx.de>
300         PR fortran/113911
301         * trans-array.cc (gfc_trans_deferred_array): Do not clobber
302         deferred length for a character variable passed as dummy argument.
304 2024-02-15  Kwok Cheung Yeung  <kcyeung@baylibre.com>
306         * dump-parse-tree.cc (show_attr): Handle omp_declare_target_indirect
307         attribute.
308         * f95-lang.cc (gfc_gnu_attributes): Add entry for 'omp declare
309         target indirect'.
310         * gfortran.h (symbol_attribute): Add omp_declare_target_indirect
311         field.
312         (struct gfc_omp_clauses): Add indirect field.
313         * openmp.cc (omp_mask2): Add OMP_CLAUSE_INDIRECT.
314         (gfc_match_omp_clauses): Match indirect clause.
315         (OMP_DECLARE_TARGET_CLAUSES): Add OMP_CLAUSE_INDIRECT.
316         (gfc_match_omp_declare_target): Check omp_device_type and apply
317         omp_declare_target_indirect attribute to symbol if indirect clause
318         active.  Show warning if there are only device_type and/or indirect
319         clauses on the directive.
320         * trans-decl.cc (add_attributes_to_decl): Add 'omp declare target
321         indirect' attribute if symbol has indirect attribute set.
323 2024-02-14  Steve Kargl  <kargl@gcc.gnu.org>
325         PR fortran/105847
326         * trans-io.cc (transfer_namelist_element): When building the
327         namelist object name, if the use rename attribute is set, use
328         the local name specified in the use statement.
330 2024-02-14  Jakub Jelinek  <jakub@redhat.com>
332         * error.cc (error_print): For u printing of ptrdiff_t,
333         print ptrdiff_t argument converted to unsigned long long and
334         masked with 2ULL * PTRDIFF_MAX + 1.
336 2024-02-13  Tobias Burnus  <tburnus@baylibre.com>
338         PR middle-end/113904
339         * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle splitting of
340         OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR.
341         * openmp.cc (gfc_match_omp_context_selector): Likewise; rejects
342         non-const device_num/condition; improve diagnostic.
344 2024-02-13  Harald Anlauf  <anlauf@gmx.de>
346         PR fortran/113866
347         * trans-expr.cc (gfc_conv_procedure_call): When passing an optional
348         dummy argument to an optional dummy argument of a bind(c) procedure
349         and the dummy argument is passed via a CFI descriptor, no special
350         presence check and passing of a default NULL pointer is needed.
352 2024-02-13  Steve Kargl  <kargl@gcc.gnu.org>
354         PR fortran/113883
355         * trans-array.cc (gfc_trans_deferred_array): Set length to zero,
356         avoiding extraneous diagnostics.
358 2024-02-10  Jakub Jelinek  <jakub@redhat.com>
360         * error.cc (error_print): Handle z and t modifiers on d, i and u.
361         * check.cc (gfc_check_transfer): Use %zd instead of %ld and casts to
362         long.
363         * primary.cc (gfc_convert_to_structure_constructor): Use %td instead
364         of %ld and casts to long.
366 2024-02-10  Jakub Jelinek  <jakub@redhat.com>
368         * trans-common.cc (build_common_decl): Use %wu instead of %lu and
369         casts to unsigned long.
370         * resolve.cc (resolve_ordinary_assign): Use %wd instead of %ld and
371         casts to long.
372         * array.cc (gfc_resolve_character_array_constructor): Likewise.
373         * data.cc (create_character_initializer): Likewise.
375 2024-02-09  Harald Anlauf  <anlauf@gmx.de>
377         PR fortran/113799
378         * arith.cc (reduce_unary): Remember any overflow encountered during
379         reduction of unary arithmetic operations on array constructors and
380         continue, and return error status, but terminate on serious errors.
382 2024-01-28  Harald Anlauf  <anlauf@gmx.de>
384         PR fortran/113377
385         * trans-expr.cc (conv_dummy_value): Treat NULL actual argument to
386         optional dummy with the VALUE attribute as not present.
387         (gfc_conv_procedure_call): Likewise.
389 2024-01-27  Harald Anlauf  <anlauf@gmx.de>
391         PR fortran/104908
392         * trans-array.cc (gfc_conv_array_ref): Restrict use of transformed
393         descriptor (sym->backend_decl) to the unlimited polymorphic case.
395 2024-01-24  Harald Anlauf  <anlauf@gmx.de>
397         PR fortran/113377
398         * trans-expr.cc (conv_dummy_value): New.
399         (gfc_conv_procedure_call): Factor code for handling dummy arguments
400         with the VALUE attribute in the scalar case into conv_dummy_value().
401         Reuse and adjust for calling elemental procedures.
403 2024-01-21  Harald Anlauf  <anlauf@gmx.de>
405         PR fortran/113377
406         * trans-expr.cc (gfc_conv_procedure_call): Fix handling of optional
407         scalar arguments of intrinsic type with the VALUE attribute.
409 2024-01-20  Mikael Morin  <mikael@gcc.gnu.org>
411         PR fortran/48776
412         PR fortran/111291
413         * parse.cc: Restore current interface to its previous value on error.
415 2024-01-19  Harald Anlauf  <anlauf@gmx.de>
417         PR fortran/113471
418         * trans-array.cc (array_bound_check_elemental): Array bounds check
419         shall apply here to elemental dimensions of an array section only.
421 2024-01-13  Harald Anlauf  <anlauf@gmx.de>
423         PR fortran/67277
424         * trans-intrinsic.cc (gfc_conv_intrinsic_ishftc): Handle optional
425         dummy argument for SIZE passed to ISHFTC.  Set default value to
426         BIT_SIZE(I) when missing.
428 2024-01-13  Harald Anlauf  <anlauf@gmx.de>
430         PR fortran/113305
431         * gfortran.h (gfc_loop_annot): New.
432         (gfc_iterator, gfc_forall_iterator): Use for annotation control.
433         * array.cc (gfc_copy_iterator): Adjust.
434         * gfortran.texi: Document annotations IVDEP, UNROLL n, VECTOR,
435         NOVECTOR as applied to DO CONCURRENT.
436         * parse.cc (parse_do_block): Parse annotations IVDEP, UNROLL n,
437         VECTOR, NOVECTOR as applied to DO CONCURRENT.  Apply UNROLL only to
438         first loop control variable.
439         * trans-stmt.cc (iter_info): Use gfc_loop_annot.
440         (gfc_trans_simple_do): Adjust.
441         (gfc_trans_forall_loop): Annotate loops with IVDEP, UNROLL n,
442         VECTOR, NOVECTOR as needed for DO CONCURRENT.
443         (gfc_trans_forall_1): Handle loop annotations.
445 2024-01-08  Harald Anlauf  <anlauf@gmx.de>
447         PR fortran/113245
448         * trans-intrinsic.cc (gfc_conv_intrinsic_size): Use
449         gfc_conv_expr_present() for proper check of optional DIM argument.
451 2024-01-06  Harald Anlauf  <anlauf@gmx.de>
452             José Rui Faustino de Sousa  <jrfsousa@gmail.com>
454         PR fortran/96724
455         * iresolve.cc (gfc_resolve_repeat): Force conversion to
456         gfc_charlen_int_kind before call to gfc_multiply.
458 2024-01-04  David Malcolm  <dmalcolm@redhat.com>
460         * lang.opt.urls: New file, autogenerated by
461         regenerate-opt-urls.py.
463 2024-01-03  Harald Anlauf  <anlauf@gmx.de>
465         * trans-types.cc (gfc_get_nodesc_array_type): Clear used gmp
466         variables.
468 2024-01-03  Jakub Jelinek  <jakub@redhat.com>
470         * gfortranspec.cc (lang_specific_driver): Update copyright notice
471         dates.
472         * gfc-internals.texi: Bump @copying's copyright year.
473         * gfortran.texi: Ditto.
474         * intrinsic.texi: Ditto.
475         * invoke.texi: Ditto.
478 Copyright (C) 2024 Free Software Foundation, Inc.
480 Copying and distribution of this file, with or without modification,
481 are permitted in any medium without royalty provided the copyright
482 notice and this notice are preserved.