[gcc(refs/users/mikael/heads/refactor_descriptor_v206.01)] fortran: array descriptor: Factor scalar descriptor init 1/2 [PR122521]
Mikael Morin via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:c301dc67f726980ae9fef007431a28bedbcaefed commit c301dc67f726980ae9fef007431a28bedbcaefed Author: Mikael Morin <[email protected]> Date: Tue Aug 18 14:15:07 2026 +0200 fortran: array descriptor: Factor scalar descriptor init 1/2 [PR122521] TODO: FAIL unlimited_polymorphic_{1,32}.f03, intent_out_19.f90, associate_66.f90 -- >8 -- The two functions gfc_set_descriptor_from_scalar and gfc_set_descriptor_from_scalar_class have very similar code, except only the former has support for coarrays and absent optional variables. Make gfc_set_descriptor_from_scalar_class call it. PR fortran/122521 gcc/fortran/ChangeLog: * trans-descriptor.cc (gfc_set_descriptor_from_scalar_class): Replace inline code with a call to gfc_set_descriptor_from_scalar. Diff: --- gcc/fortran/trans-descriptor.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 6c3abd7a5a6f..534e9fe88dc8 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -913,11 +913,8 @@ gfc_set_descriptor_from_scalar_class (stmtblock_t *block, tree descr, tree scalar, gfc_expr *scalar_expr) { tree tmp = gfc_class_data_get (scalar); - tree type = gfc_get_scalar_to_descriptor_type (TREE_TYPE (tmp), - gfc_expr_attr (scalar_expr)); - gfc_conv_descriptor_dtype_set (block, descr, - gfc_get_dtype (type)); - gfc_conv_descriptor_data_set (block, descr, tmp); + gfc_set_descriptor_from_scalar (block, descr, tmp, scalar_expr, NULL_TREE, + NULL_TREE); }