https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92305
--- Comment #14 from Tobias Burnus <burnus at gcc dot gnu.org> --- If the actual argument is itself optional but without value attribute, gfc_conv_expr_present returns a 'logical_type_node' (default-integer size, typically 4 bytes type) instead of a boolean_type_node (1 byte), which might causes problems. However, for the test case of comment 9, this does not apply as there the boolean_true_node is used (which is 1 byte) – which matches the declaration in trans-decl.c (= boolean_type_node). diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 63559384c1e..267536ddf2f 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -5753 +5753,3 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, - vec_safe_push (optionalargs, tmp); + vec_safe_push (optionalargs, + fold_convert (boolean_type_node, + tmp));