aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog46
-rw-r--r--gcc/fortran/trans-expr.cc24
2 files changed, 70 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 147fb1d..b452bc9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,49 @@
+2023-06-24 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/110360
+ * trans-expr.cc (gfc_conv_procedure_call): Truncate constant string
+ argument of length > 1 passed to scalar CHARACTER(1),VALUE dummy.
+
+2023-06-23 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/110360
+ * trans-expr.cc (gfc_conv_procedure_call): Pass actual argument
+ to scalar CHARACTER(1),VALUE dummy argument by value.
+
+2023-06-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/87477
+ PR fortran/88688
+ PR fortran/94380
+ PR fortran/107900
+ PR fortran/110224
+ * decl.cc (char_len_param_value): Fix memory leak.
+ (resolve_block_construct): Remove unnecessary static decls.
+ * expr.cc (gfc_is_ptr_fcn): New function.
+ (gfc_check_vardef_context): Use it to permit pointer function
+ result selectors to be used for associate names in variable
+ definition context.
+ * gfortran.h: Prototype for gfc_is_ptr_fcn.
+ * match.cc (build_associate_name): New function.
+ (gfc_match_select_type): Use the new function to replace inline
+ version and to build a new associate name for the case where
+ the supplied associate name is already used for that purpose.
+ * resolve.cc (resolve_assoc_var): Call gfc_is_ptr_fcn to allow
+ associate names with pointer function targets to be used in
+ variable definition context.
+ * trans-decl.cc (gfc_get_symbol_decl): Unlimited polymorphic
+ variables need deferred initialisation of the vptr.
+ (gfc_trans_deferred_vars): Do the vptr initialisation.
+ * trans-stmt.cc (trans_associate_var): Ensure that a pointer
+ associate name points to the target of the selector and not
+ the selector itself.
+
+2023-06-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/108961
+ * trans-expr.cc (gfc_conv_procedure_call): The hidden string
+ length must not be passed to a formal arg of type(cptr).
+
2023-06-20 Tobias Burnus <tobias@codesourcery.com>
* dump-parse-tree.cc (show_omp_namelist): Fix dump of the allocator
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 3c209bc..63e3cf9 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -6392,6 +6392,30 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else
{
gfc_conv_expr (&parmse, e);
+
+ /* ABI: actual arguments to CHARACTER(len=1),VALUE
+ dummy arguments are actually passed by value.
+ Constant strings are truncated to length 1.
+ The BIND(C) case is handled elsewhere. */
+ if (fsym->ts.type == BT_CHARACTER
+ && !fsym->ts.is_c_interop
+ && fsym->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && fsym->ts.u.cl->length->ts.type == BT_INTEGER
+ && (mpz_cmp_ui
+ (fsym->ts.u.cl->length->value.integer, 1) == 0))
+ {
+ if (e->expr_type != EXPR_CONSTANT)
+ parmse.expr = gfc_string_to_single_character
+ (build_int_cst (gfc_charlen_type_node, 1),
+ parmse.expr,
+ e->ts.kind);
+ else if (e->value.character.length > 1)
+ {
+ e->value.character.length = 1;
+ gfc_conv_expr (&parmse, e);
+ }
+ }
+
if (fsym->attr.optional
&& fsym->ts.type != BT_CLASS
&& fsym->ts.type != BT_DERIVED)