PR 84740 Wrong string length type in bounds check
[official-gcc.git] / gcc / fortran / ChangeLog
blob8ee13b1930f9e6ae76ffd366c3f2e1bc428b0a39
1 2018-01-10  Janne Blomqvist  <jb@gcc.gnu.org>
3         PR fortran/84740
4         * trans-array.c (gfc_trans_array_ctor_element): Convert RHS to the
5         LHS type when assigning.
7 2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>
9         PR fortran/83742
10         * expr.c (gfc_is_simply_contiguous): Check for NULL pointer.
12 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
14         * match.c (gfc_match_allocate): Check for NULL pointer.
16 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
18         * expr.c (gfc_check_pointer_assign): Fix typo in comment.
20 2018-01-08  Paul Thomas  <pault@gcc.gnu.org>
22         PR fortran/83611
23         * decl.c (gfc_get_pdt_instance): If parameterized arrays have
24         an initializer, convert the kind parameters and add to the
25         component if the instance.
26         * trans-array.c (structure_alloc_comps): Add 'is_pdt_type' and
27         use it with case COPY_ALLOC_COMP. Call 'duplicate_allocatable'
28         for parameterized arrays. Clean up typos in comments. Convert
29         parameterized array initializers and copy into the array.
30         * trans-expr.c (gfc_trans_scalar_assign): Do a deep copy for
31         parameterized types.
32         *trans-stmt.c (trans_associate_var): Deallocate associate vars
33         as necessary, when they are PDT function results for example.
35         PR fortran/83731
36         * trans-array.c (structure_alloc_comps): Only compare len parms
37         when they are declared explicitly.
39 2018-01-06  Janne Blomqvist  <jb@gcc.gnu.org>
41         PR fortran/50892
42         * trans-expr.c (gfc_trans_pointer_assignment): fold_convert rhs to
43         lhs type.
45 2018-01-05  Janne Blomqvist  <jb@gcc.gnu.org>
47         PR fortran/78534
48         PR fortran/66310
49         * array.c (got_charlen): Use gfc_charlen_int_kind.
50         * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of
51         hardcoded kind.
52         (find_intrinsic_vtab): Likewise.
53         * decl.c (match_char_length): Use gfc_charlen_int_kind.
54         (add_init_expr_to_sym): Use gfc_charlen_t and gfc_charlen_int_kind.
55         (gfc_match_implicit): Use gfc_charlen_int_kind.
56         * dump-parse-tree.c (show_char_const): Use gfc_charlen_t and size_t.
57         (show_expr): Use HOST_WIDE_INT_PRINT_DEC.
58         * expr.c (gfc_get_character_expr): Length parameter of type
59         gfc_charlen_t.
60         (gfc_get_int_expr): Value argument of type HOST_WIDE_INT.
61         (gfc_extract_hwi): New function.
62         (simplify_const_ref): Make string_len of type gfc_charlen_t.
63         (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs.
64         * frontend-passes.c (optimize_trim): Use gfc_charlen_int_kind.
65         * gfortran.h (gfc_mpz_get_hwi): New prototype.
66         (gfc_mpz_set_hwi): Likewise.
67         (gfc_charlen_t): New typedef.
68         (gfc_expr): Use gfc_charlen_t for character lengths.
69         (gfc_size_kind): New extern variable.
70         (gfc_extract_hwi): New prototype.
71         (gfc_get_character_expr): Use gfc_charlen_t for character length.
72         (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument.
73         * gfortran.texi: Update description of hidden string length argument.
74         * iresolve.c (check_charlen_present): Use gfc_charlen_int_kind.
75         (gfc_resolve_char_achar): Likewise.
76         (gfc_resolve_repeat): Pass string length directly without
77         temporary, use gfc_charlen_int_kind.
78         (gfc_resolve_transfer): Use gfc_charlen_int_kind.
79         * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen.
80         * misc.c (gfc_mpz_get_hwi): New function.
81         (gfc_mpz_set_hwi): New function.
82         * module.c (atom_int): Change type from int to HOST_WIDE_INT.
83         (parse_integer): Don't complain about large integers.
84         (write_atom): Use HOST_WIDE_INT for integers.
85         (mio_integer): Handle integer type mismatch.
86         (mio_hwi): New function.
87         (mio_intrinsic_op): Use HOST_WIDE_INT.
88         (mio_array_ref): Likewise.
89         (mio_expr): Likewise.
90         * primary.c (match_substring): Use gfc_charlen_int_kind.
91         * resolve.c (resolve_substring_charlen): Use gfc_charlen_int_kind.
92         (resolve_character_operator): Likewise.
93         (resolve_assoc_var): Likewise.
94         (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf.
95         (resolve_charlen): Use mpz_sgn to determine sign.
96         * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t
97         instead of long.
98         * symbol.c (generate_isocbinding_symbol): Use gfc_charlen_int_kind.
99         * target-memory.c (size_character): Length argument of type
100         gfc_charlen_t.
101         (gfc_encode_character): Likewise.
102         (gfc_interpret_character): Use gfc_charlen_t.
103         * target-memory.h (gfc_encode_character): Modify prototype.
104         * trans-array.c (gfc_trans_array_ctor_element): Use existing type.
105         (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type.
106         (trans_array_constructor): Use existing type.
107         (get_array_charlen): Likewise.
108         * trans-const.c (gfc_conv_mpz_to_tree_type): New function.
109         * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype.
110         * trans-decl.c (gfc_trans_deferred_vars): Use existing type.
111         (add_argument_checking): Likewise.
112         * trans-expr.c (gfc_class_len_or_zero_get): Build const of type
113         gfc_charlen_type_node.
114         (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of
115         4, fold_convert to correct type.
116         (gfc_conv_class_to_class): Build const of type size_type_node for
117         size.
118         (gfc_copy_class_to_class): Likewise.
119         (gfc_conv_string_length): Use same type in expression.
120         (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen.
121         (gfc_conv_string_tmp): Make sure len is of the right type.
122         (gfc_conv_concat_op): Use same type in expression.
123         (gfc_conv_procedure_call): Likewise.
124         (fill_with_spaces): Comment out memset() block due to spurious
125         -Wstringop-overflow warnings.
126         (gfc_trans_string_copy): Use gfc_charlen_type_node.
127         (alloc_scalar_allocatable_for_subcomponent_assignment):
128         fold_convert to right type.
129         (gfc_trans_subcomponent_assign): Likewise.
130         (trans_class_vptr_len_assignment): Build const of correct type.
131         (gfc_trans_pointer_assignment): Likewise.
132         (alloc_scalar_allocatable_for_assignment): fold_convert to right
133         type in expr.
134         (trans_class_assignment): Build const of correct type.
135         * trans-intrinsic.c (gfc_conv_associated): Likewise.
136         (gfc_conv_intrinsic_repeat): Do calculation in sizetype.
137         * trans-io.c (gfc_build_io_library_fndecls): Use
138         gfc_charlen_type_node for character lengths.
139         (set_string): Convert to right type in assignment.
140         * trans-stmt.c (gfc_trans_label_assign): Build const of
141         gfc_charlen_type_node.
142         (trans_associate_var): Likewise.
143         (gfc_trans_character_select): Likewise.
144         (gfc_trans_allocate): Likewise, don't typecast strlen result.
145         (gfc_trans_deallocate): Don't typecast strlen result.
146         * trans-types.c (gfc_size_kind): New variable.
147         (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind
148         from size_type_node.
149         * trans-types.h: Fix comment.
151 2018-01-04  Thomas Koenig  <tkoenig@gcc.gnu.org>
153         PR fortran/83683
154         PR fortran/45689
155         * check.c (gfc_check_eoshift): Check for string length and
156         for conformance of boundary.
157         * intrinsic.c (add_functions): Add gfc_simplify_eoshift.
158         * intrinsic.h: Add prototype for gfc_simplify_eoshift.
159         * simplify.c (gfc_simplify_eoshift): New function.
161 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
162             Alan Hayward  <alan.hayward@arm.com>
163             David Sherwood  <david.sherwood@arm.com>
165         * trans-types.c (gfc_type_for_mode): Handle MODE_VECTOR_BOOL.
167 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
168             Alan Hayward  <alan.hayward@arm.com>
169             David Sherwood  <david.sherwood@arm.com>
171         * trans-types.c (gfc_type_for_mode): Check valid_vector_subparts_p.
173 2018-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
175         PR fortran/83664
176         * check.c (gfc_check_eoshift): Error for missing boundary if array
177         is not one of the standard types.
179 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
181         Update copyright years.
183         * gfortranspec.c (lang_specific_driver): Update copyright notice
184         dates.
185         * gfc-internals.texi: Bump @copying's copyright year.
186         * gfortran.texi: Ditto.
187         * intrinsic.texi: Ditto.
188         * invoke.texi: Ditto.
190 2017-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
192         PR fortran/45689
193         * intrinsic.c (add_function): Add gfc_simplify_maxloc and
194         gfc_simplify_minloc to maxloc and minloc, respectively.
195         * intrinsic.h: Add prototypes for gfc_simplify_minloc
196         and gfc_simplify_maxloc.
197         * simplify.c (min_max_chose): Adjust prototype.  Modify function
198         to have a return value which indicates if the extremum was found.
199         (is_constant_array_expr): Fix typo in comment.
200         (simplify_minmaxloc_to_scalar): New function.
201         (simplify_minmaxloc_nodim): New function.
202         (new_array): New function.
203         (simplify_minmaxloc_to_array): New function.
204         (gfc_simplify_minmaxloc): New function.
205         (simplify_minloc): New function.
206         (simplify_maxloc): New function.
208 2018-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
210         PR fortran/45689
211         PR fortran/83650
212         * simplify.c (gfc_simplify_cshift): Re-implement to allow full
213         range of arguments.
215 2018-01-01  Paul Thomas  <pault@gcc.gnu.org>
217         PR fortran/83076
218         * resolve.c (resolve_fl_derived0): Add caf_token fields for
219         allocatable and pointer scalars, when -fcoarray selected.
220         * trans-types.c (gfc_copy_dt_decls_ifequal): Copy the token
221         field as well as the backend_decl.
222         (gfc_get_derived_type): Flag GFC_FCOARRAY_LIB for module
223         derived types that are not vtypes. Components with caf_token
224         attribute are pvoid types. For a component requiring it, find
225         the caf_token field and have the component token field point to
226         its backend_decl.
228         PR fortran/83319
229         *trans-types.c (gfc_get_array_descriptor_base): Add the token
230         field to the descriptor even when codimen not set.
232 Copyright (C) 2018 Free Software Foundation, Inc.
234 Copying and distribution of this file, with or without modification,
235 are permitted in any medium without royalty provided the copyright
236 notice and this notice are preserved.