PR fortran/84065
[official-gcc.git] / gcc / fortran / ChangeLog
blob8660530c07388a09d8f6f0b2d3a0f73667888988
1 2018-01-27  Jakub Jelinek  <jakub@redhat.com>
3         PR fortran/84065
4         * decl.c (add_init_expr_to_sym): Ignore initializers for too large
5         lengths.
7 2018-01-26  Damian Rouson  <damian@sourceryinstitute.org>
8             Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>
9             Soren Rasmussen  <s.c.rasmussen@gmail.com>
11         Partial support for Fortran 2018 teams features.
13         * array.c (gfc_match_array_ref): add team attribute in coarray
14         transfers.
15         * check.c (gfc_check_get_team, gfc_check_team_number): add new
16         functions for get_team and team_number.
17         * dump-parse-tree.c (show_code_node): add new statements: form team,
18         change team, end team, and sync team.
19         * expr.c (gfc_find_team_co): add new function.
20         * gfortran.h: add new statements.
21         * intrinsic.c (add_functions): add get_team and team_number functions.
22         * intrinsic.h: add get_team and team_number prototypes for check,
23         simplify, and resolve.
24         * iresolve.c (gfc_resolve_get_team, gfc_resolve_team_number): add new
25         functions.
26         * iso-fortran-env.def: add the team_type derived type.
27         * match.c (gfc_match_if, gfc_match_form_team, gfc_match_team_number)
28         (gfc_match_end_team, gfc_match_sync_team, gfc_match_change_team):
29         add change team, end team, form team, sync team match and functions.
30         * match.h: add new prototypes for change team, end team, form team,
31         and sync team.
32         * parse.c (decode_statement): add cases for change team, end team,
33         form team, and sync team.
34         * resolve.c: add cases for exec form team, change team, end team, and
35         sync team.
36         * simplify.c (gfc_simplify_get_team): add new function for get team.
37         * st.c (gfc_free_statement): add cases exec for change team, end team,
38         form team, sync team.
39         * trans-decl.c (gfor_fndecl_caf_form_team)
40         (gfor_fndecl_caf_change_team, gfor_fndecl_caf_end_team)
41         (gfor_fndecl_caf_sync_team, gfor_fndecl_caf_get_team)
42         (gfor_fndecl_caf_team_number): add functions and definitions.
43         * trans-intrinsic.c (conv_caf_send, conv_intrinsic_team_number): add
44         new function and team_type argument support.
45         * trans-stmt.c (gfc_trans_form_team, gfc_trans_change_team)
46         (gfc_trans_end_team, gfc_trans_sync_team): add new functions.
47         * trans-stmt.h: add new prototypes.
48         * trans-types.c (gfc_get_derived_type): check condition for team_type.
49         * trans.c (trans_code): new exec cases for form team, change team, end
50         team, and sync team.
51         * trans.h: add new prototypes.
53 2018-01-26  Steven G. Kargl  <kargl@gcc.gnu.org>
55         PR fortran/83998
56         * simplify.c (compute_dot_product):  Initialize result to INTEGER(1) 0
57         or .false.  The summation does the correct type conversion.
58         (gfc_simplify_dot_product): Special case zero-sized arrays.
60 2018-25-01  Paul Thomas  <pault@gcc.gnu.org>
62         PR fortran/37577
63         * array.c (gfc_match_array_ref): If standard earlier than F2008
64         it is an error if the reference dimension is greater than 7.
65         libgfortran.h : Increase GFC_MAX_DIMENSIONS to 15. Change the
66         dtype masks and shifts accordingly.
67         * trans-array.c (gfc_conv_descriptor_dtype): Use the dtype
68         type node to check the field.
69         (gfc_conv_descriptor_dtype): Access the rank field of dtype.
70         (duplicate_allocatable_coarray): Access the rank field of the
71         dtype descriptor rather than the dtype itself.
72         * trans-expr.c (get_scalar_to_descriptor_type): Store the type
73         of 'scalar' on entry and use its TREE_TYPE if it is ARRAY_TYPE
74         (ie. a character).
75         (gfc_conv_procedure_call): Pass TREE_OPERAND (tmp,0) to
76         get_scalar_to_descriptor_type if the actual expression is a
77         constant.
78         (gfc_trans_structure_assign): Assign the rank directly to the
79         dtype rank field.
80         * trans-intrinsic.c (gfc_conv_intrinsic_rank): Cast the result
81         to default integer kind.
82         (gfc_conv_intrinsic_sizeof): Obtain the element size from the
83         'elem_len' field of the dtype.
84         * trans-io.c (gfc_build_io_library_fndecls): Replace
85         gfc_int4_type_node with dtype_type_node where necessary.
86         (transfer_namelist_element): Use gfc_get_dtype_rank_type for
87         scalars.
88         * trans-types.c : Provide 'get_dtype_type_node' to acces the
89         dtype_type_node and, if necessary, build it.
90         The maximum size of an array element is now determined by the
91         maximum value of size_t.
92         Update the description of the array descriptor, including the
93         type def for the dtype_type.
94         (gfc_get_dtype_rank_type): Build a constructor for the dtype.
95         Distinguish RECORD_TYPEs that are BT_DERIVED or BT_CLASS.
96         (gfc_get_array_descriptor_base): Change the type of the dtype
97         field to dtype_type_node.
98         (gfc_get_array_descr_info): Get the offset to the rank field of
99         the dtype.
100         * trans-types.h : Add a prototype for 'get_dtype_type_node ()'.
101         * trans.h : Define the indices of the dtype fields.
103 2018-23-01  Paul Thomas  <pault@gcc.gnu.org>
105         PR fortran/83866
106         * decl.c (gfc_match_derived_decl): If eos not matched, recover
107         and emit error about garbage after declaration.
109 2018-23-01  Paul Thomas  <pault@gcc.gnu.org>
111         PR fortran/83898
112         * trans-stmt.c (trans_associate_var): Do not set cst_array_ctor
113         for characters.
115 2018-01-22  Janne Blomqvist  <jb@gcc.gnu.org>
117         PR 78534
118         PR 83704
119         * arith.c (gfc_arith_concat): Use size_t for string length.
120         (gfc_compare_string): Likewise.
121         (gfc_compare_with_Cstring): Likewise.
122         * array.c (gfc_resolve_character_array_constructor): Use
123         HOST_WIDE_INT, gfc_mpz_get_hwi.
124         * check.c (gfc_check_fe_runtime_error): Use size_t.
125         * data.c (create_character_initializer): Use HOST_WIDE_INT,
126         gfc_extract_hwi.
127         * decl.c (gfc_set_constant_character_len): Use gfc_charlen_t.
128         (add_init_expr_to_sym): Use HOST_WIDE_INT.
129         * expr.c (gfc_build_init_expr): Use HOST_WIDE_INT,
130         gfc_extract_hwi.
131         (gfc_apply_init): Likewise.
132         * match.h (gfc_set_constant_character_len): Update prototype.
133         * primary.c (match_string_constant): Use size_t.
134         * resolve.c (resolve_ordinary_assign): Use HOST_WIDE_INT,
135         gfc_mpz_get_hwi.
136         * simplify.c (init_result_expr): Likewise.
137         (gfc_simplify_len_trim): Use size_t.
138         * target-memory.c (gfc_encode_character): Use size_t.
139         (gfc_target_encode_expr): Use HOST_WIDE_INT, gfc_mpz_get_hwi.
140         (interpret_array): Use size_t.
141         (gfc_interpret_character): Likewise.
142         * target-memory.h (gfc_encode_character): Update prototype.
143         (gfc_interpret_character): Likewise.
144         (gfc_target_interpret_expr): Likewise.
145         * trans-const.c (gfc_build_string_const): Use size_t for length
146         argument.
147         (gfc_build_wide_string_const): Likewise.
148         * trans-const.h (gfc_build_string_const): Likewise.
149         (gfc_build_wide_string_const): Likewise.
151 2018-01-20  Steven G. Kargl  <kargl@gcc.gnu.org>
153         PR fortran/83900
154     * simplify.c (gfc_simplify_matmul): Set return type correctly.
156 2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>
158         PR fortran/83900
159         * simplify.c (gfc_simplify_matmul): Delete bogus assertion.
161 2018-01-17  Harald Anlauf  <anlauf@gmx.de>
163         PR fortran/83864
164         * expr.c (add_init_expr_to_sym): Do not dereference NULL pointer.
166 2018-01-17  Harald Anlauf  <anlauf@gmx.de>
168         PR fortran/83874
169         * decl.c (add_init_expr_to_sym): Do not dereference NULL pointer.
171 2018-01-15  Louis Krupp  <louis.krupp@zoho.com>
173         PR fortran/82257
174         * interface.c (compare_rank): Don't try to retrieve CLASS_DATA
175         from symbol marked unlimited polymorphic.
176         * resolve.c (resolve_structure_cons): Likewise.
177         * misc.c (gfc_typename): Don't dereference derived->components
178         if it's NULL.
180 2018-01-15  Thomas Koenig  <tkoenig@gcc.gnu.org>
182         PR fortran/54613
183         * gfortran.h (gfc_check_f): Rename f4ml to f5ml.
184         (gfc_logical_4_kind): New macro
185         * intrinsic.h (gfc_simplify_minloc): Add a gfc_expr *argument.
186         (gfc_simplify_maxloc): Likewise.
187         (gfc_resolve_maxloc): Likewise.
188         (gfc_resolve_minloc): Likewise.
189         * check.c (gfc_check_minloc_maxloc): Add checking for "back"
190         argument; also raise error if it is used (for now). Add it
191         if it isn't present.
192         * intrinsic.c (add_sym_4ml): Rename to
193         (add_sym_5ml), adjust for extra argument.
194         (add_functions): Add "back" constant. Adjust maxloc and minloc
195         for back argument.
196         * iresolve.c (gfc_resolve_maxloc): Add back argument. If back is
197         not of gfc_logical_4_kind, convert.
198         (gfc_resolve_minloc): Likewise.
199         * simplify.c (gfc_simplify_minloc): Add back argument.
200         (gfc_simplify_maxloc): Likewise.
201         * trans-intinsic.c (gfc_conv_intrinsic_minmaxloc): Rename last
202         argument to %VAL to ensure passing by value.
203         (gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_minmaxloc
204         also for library calls.
206 2018-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
208         PR fortran/82007
209         * resolve.c (resolve_transfer): Delete code looking for 'DT'
210         format specifiers in format strings. Set formatted to true if a
211         format string or format label is present.
212         * trans-io.c (get_dtio_proc): Likewise. (transfer_expr): Fix
213         whitespace.
215 2018-01-13  Thomas Koenig <tkoenig@gcc.gnu.org>
217         PR fortran/83744
218         * dump-parse-tree.c (get_c_type_name): Remove extra line.
219         Change for loop to use declaration in for loop. Handle BT_LOGICAL
220         and BT_CHARACTER.
221         (write_decl): Add where argument. Fix indentation. Replace
222         assert with error message. Add typename to warning
223         in comment.
224         (write_type): Adjust locus to call of write_decl.
225         (write_variable): Likewise.
226         (write_proc): Likewise. Replace assert with error message.
228 2018-01-13  Paul Thomas  <pault@gcc.gnu.org>
230         PR fortran/52162
231         * trans-expr.c (gfc_trans_scalar_assign): Flag is_alloc_lhs if
232         the rhs expression is neither an elemental nor a conversion
233         function.
235         PR fortran/83622
236         * trans-array.c (is_pointer_array): Remove unconditional return
237         of false for -fopenmp.
239 2018-01-13  Thomas Koenig <tkoenig@gcc.gnu.org>
240         <emsr@gcc.gnu.org>
242         PR fortran/83803
243         * dump-parse-tree.c (write_proc): Always emit closing parenthesis
244         for functions.
246 2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>
248         PR fortran/82367
249         * resolve.c (resolve_allocate_expr): Check for NULL pointer.
251 2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>
253         PR fortran/83093
254         * resolve.c (resolve_charlen): Check the type of cl->length
255         after resolution.
257 2018-01-10  Janne Blomqvist  <jb@gcc.gnu.org>
259         PR fortran/83740
260         * trans-array.c (gfc_trans_array_ctor_element): Fix formatting.
262 2018-01-10  Janne Blomqvist  <jb@gcc.gnu.org>
264         PR fortran/83740
265         * trans-array.c (gfc_trans_array_ctor_element): Convert RHS to the
266         LHS type when assigning.
268 2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>
270         PR fortran/83742
271         * expr.c (gfc_is_simply_contiguous): Check for NULL pointer.
273 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
275         * match.c (gfc_match_allocate): Check for NULL pointer.
277 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
279         * expr.c (gfc_check_pointer_assign): Fix typo in comment.
281 2018-01-08  Paul Thomas  <pault@gcc.gnu.org>
283         PR fortran/83611
284         * decl.c (gfc_get_pdt_instance): If parameterized arrays have
285         an initializer, convert the kind parameters and add to the
286         component if the instance.
287         * trans-array.c (structure_alloc_comps): Add 'is_pdt_type' and
288         use it with case COPY_ALLOC_COMP. Call 'duplicate_allocatable'
289         for parameterized arrays. Clean up typos in comments. Convert
290         parameterized array initializers and copy into the array.
291         * trans-expr.c (gfc_trans_scalar_assign): Do a deep copy for
292         parameterized types.
293         *trans-stmt.c (trans_associate_var): Deallocate associate vars
294         as necessary, when they are PDT function results for example.
296         PR fortran/83731
297         * trans-array.c (structure_alloc_comps): Only compare len parms
298         when they are declared explicitly.
300 2018-01-06  Janne Blomqvist  <jb@gcc.gnu.org>
302         PR fortran/50892
303         * trans-expr.c (gfc_trans_pointer_assignment): fold_convert rhs to
304         lhs type.
306 2018-01-05  Janne Blomqvist  <jb@gcc.gnu.org>
308         PR fortran/78534
309         PR fortran/66310
310         * array.c (got_charlen): Use gfc_charlen_int_kind.
311         * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of
312         hardcoded kind.
313         (find_intrinsic_vtab): Likewise.
314         * decl.c (match_char_length): Use gfc_charlen_int_kind.
315         (add_init_expr_to_sym): Use gfc_charlen_t and gfc_charlen_int_kind.
316         (gfc_match_implicit): Use gfc_charlen_int_kind.
317         * dump-parse-tree.c (show_char_const): Use gfc_charlen_t and size_t.
318         (show_expr): Use HOST_WIDE_INT_PRINT_DEC.
319         * expr.c (gfc_get_character_expr): Length parameter of type
320         gfc_charlen_t.
321         (gfc_get_int_expr): Value argument of type HOST_WIDE_INT.
322         (gfc_extract_hwi): New function.
323         (simplify_const_ref): Make string_len of type gfc_charlen_t.
324         (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs.
325         * frontend-passes.c (optimize_trim): Use gfc_charlen_int_kind.
326         * gfortran.h (gfc_mpz_get_hwi): New prototype.
327         (gfc_mpz_set_hwi): Likewise.
328         (gfc_charlen_t): New typedef.
329         (gfc_expr): Use gfc_charlen_t for character lengths.
330         (gfc_size_kind): New extern variable.
331         (gfc_extract_hwi): New prototype.
332         (gfc_get_character_expr): Use gfc_charlen_t for character length.
333         (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument.
334         * gfortran.texi: Update description of hidden string length argument.
335         * iresolve.c (check_charlen_present): Use gfc_charlen_int_kind.
336         (gfc_resolve_char_achar): Likewise.
337         (gfc_resolve_repeat): Pass string length directly without
338         temporary, use gfc_charlen_int_kind.
339         (gfc_resolve_transfer): Use gfc_charlen_int_kind.
340         * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen.
341         * misc.c (gfc_mpz_get_hwi): New function.
342         (gfc_mpz_set_hwi): New function.
343         * module.c (atom_int): Change type from int to HOST_WIDE_INT.
344         (parse_integer): Don't complain about large integers.
345         (write_atom): Use HOST_WIDE_INT for integers.
346         (mio_integer): Handle integer type mismatch.
347         (mio_hwi): New function.
348         (mio_intrinsic_op): Use HOST_WIDE_INT.
349         (mio_array_ref): Likewise.
350         (mio_expr): Likewise.
351         * primary.c (match_substring): Use gfc_charlen_int_kind.
352         * resolve.c (resolve_substring_charlen): Use gfc_charlen_int_kind.
353         (resolve_character_operator): Likewise.
354         (resolve_assoc_var): Likewise.
355         (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf.
356         (resolve_charlen): Use mpz_sgn to determine sign.
357         * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t
358         instead of long.
359         * symbol.c (generate_isocbinding_symbol): Use gfc_charlen_int_kind.
360         * target-memory.c (size_character): Length argument of type
361         gfc_charlen_t.
362         (gfc_encode_character): Likewise.
363         (gfc_interpret_character): Use gfc_charlen_t.
364         * target-memory.h (gfc_encode_character): Modify prototype.
365         * trans-array.c (gfc_trans_array_ctor_element): Use existing type.
366         (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type.
367         (trans_array_constructor): Use existing type.
368         (get_array_charlen): Likewise.
369         * trans-const.c (gfc_conv_mpz_to_tree_type): New function.
370         * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype.
371         * trans-decl.c (gfc_trans_deferred_vars): Use existing type.
372         (add_argument_checking): Likewise.
373         * trans-expr.c (gfc_class_len_or_zero_get): Build const of type
374         gfc_charlen_type_node.
375         (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of
376         4, fold_convert to correct type.
377         (gfc_conv_class_to_class): Build const of type size_type_node for
378         size.
379         (gfc_copy_class_to_class): Likewise.
380         (gfc_conv_string_length): Use same type in expression.
381         (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen.
382         (gfc_conv_string_tmp): Make sure len is of the right type.
383         (gfc_conv_concat_op): Use same type in expression.
384         (gfc_conv_procedure_call): Likewise.
385         (fill_with_spaces): Comment out memset() block due to spurious
386         -Wstringop-overflow warnings.
387         (gfc_trans_string_copy): Use gfc_charlen_type_node.
388         (alloc_scalar_allocatable_for_subcomponent_assignment):
389         fold_convert to right type.
390         (gfc_trans_subcomponent_assign): Likewise.
391         (trans_class_vptr_len_assignment): Build const of correct type.
392         (gfc_trans_pointer_assignment): Likewise.
393         (alloc_scalar_allocatable_for_assignment): fold_convert to right
394         type in expr.
395         (trans_class_assignment): Build const of correct type.
396         * trans-intrinsic.c (gfc_conv_associated): Likewise.
397         (gfc_conv_intrinsic_repeat): Do calculation in sizetype.
398         * trans-io.c (gfc_build_io_library_fndecls): Use
399         gfc_charlen_type_node for character lengths.
400         (set_string): Convert to right type in assignment.
401         * trans-stmt.c (gfc_trans_label_assign): Build const of
402         gfc_charlen_type_node.
403         (trans_associate_var): Likewise.
404         (gfc_trans_character_select): Likewise.
405         (gfc_trans_allocate): Likewise, don't typecast strlen result.
406         (gfc_trans_deallocate): Don't typecast strlen result.
407         * trans-types.c (gfc_size_kind): New variable.
408         (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind
409         from size_type_node.
410         * trans-types.h: Fix comment.
412 2018-01-04  Thomas Koenig  <tkoenig@gcc.gnu.org>
414         PR fortran/83683
415         PR fortran/45689
416         * check.c (gfc_check_eoshift): Check for string length and
417         for conformance of boundary.
418         * intrinsic.c (add_functions): Add gfc_simplify_eoshift.
419         * intrinsic.h: Add prototype for gfc_simplify_eoshift.
420         * simplify.c (gfc_simplify_eoshift): New function.
422 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
423             Alan Hayward  <alan.hayward@arm.com>
424             David Sherwood  <david.sherwood@arm.com>
426         * trans-types.c (gfc_type_for_mode): Handle MODE_VECTOR_BOOL.
428 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
429             Alan Hayward  <alan.hayward@arm.com>
430             David Sherwood  <david.sherwood@arm.com>
432         * trans-types.c (gfc_type_for_mode): Check valid_vector_subparts_p.
434 2018-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
436         PR fortran/83664
437         * check.c (gfc_check_eoshift): Error for missing boundary if array
438         is not one of the standard types.
440 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
442         Update copyright years.
444         * gfortranspec.c (lang_specific_driver): Update copyright notice
445         dates.
446         * gfc-internals.texi: Bump @copying's copyright year.
447         * gfortran.texi: Ditto.
448         * intrinsic.texi: Ditto.
449         * invoke.texi: Ditto.
451 2017-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
453         PR fortran/45689
454         * intrinsic.c (add_function): Add gfc_simplify_maxloc and
455         gfc_simplify_minloc to maxloc and minloc, respectively.
456         * intrinsic.h: Add prototypes for gfc_simplify_minloc
457         and gfc_simplify_maxloc.
458         * simplify.c (min_max_chose): Adjust prototype.  Modify function
459         to have a return value which indicates if the extremum was found.
460         (is_constant_array_expr): Fix typo in comment.
461         (simplify_minmaxloc_to_scalar): New function.
462         (simplify_minmaxloc_nodim): New function.
463         (new_array): New function.
464         (simplify_minmaxloc_to_array): New function.
465         (gfc_simplify_minmaxloc): New function.
466         (simplify_minloc): New function.
467         (simplify_maxloc): New function.
469 2018-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
471         PR fortran/45689
472         PR fortran/83650
473         * simplify.c (gfc_simplify_cshift): Re-implement to allow full
474         range of arguments.
476 2018-01-01  Paul Thomas  <pault@gcc.gnu.org>
478         PR fortran/83076
479         * resolve.c (resolve_fl_derived0): Add caf_token fields for
480         allocatable and pointer scalars, when -fcoarray selected.
481         * trans-types.c (gfc_copy_dt_decls_ifequal): Copy the token
482         field as well as the backend_decl.
483         (gfc_get_derived_type): Flag GFC_FCOARRAY_LIB for module
484         derived types that are not vtypes. Components with caf_token
485         attribute are pvoid types. For a component requiring it, find
486         the caf_token field and have the component token field point to
487         its backend_decl.
489         PR fortran/83319
490         *trans-types.c (gfc_get_array_descriptor_base): Add the token
491         field to the descriptor even when codimen not set.
493 Copyright (C) 2018 Free Software Foundation, Inc.
495 Copying and distribution of this file, with or without modification,
496 are permitted in any medium without royalty provided the copyright
497 notice and this notice are preserved.