https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122463
Bug ID: 122463
Summary: [Coarray] Cleanup in conv_intrinsic_atomic_op /
conv_intrinsic_atomic_ref
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Based on https://gcc.gnu.org/pipermail/fortran/2025-October/063036.html and
the required change in the testsuite:
* It seems as if the value conversion now obsoleted the following code,
i.e. can be removed (to be checked).
(see previous email in the thread that uses 'gfc_conv_constant',
https://gcc.gnu.org/pipermail/fortran/2025-October/063035.html )
* Or maybe it didn't as this only handles constants and not other
expressions?
* The comment above the needs-to-be-pointer check looks somehow odd.
It only checks whether a pointer is needed or not – which is not the
same as having the wrong type.
RFC: Is the following correct? If not, should the if conditions be updated
and/or only the comment?
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -12561,9 +12561,2 @@ conv_intrinsic_atomic_op (gfc_code *code)
- if (!POINTER_TYPE_P (TREE_TYPE (value)))
- {
- tmp = gfc_create_var (TREE_TYPE (TREE_TYPE (atom)), "value");
- gfc_add_modify (&block, tmp, fold_convert (TREE_TYPE (tmp), value));
- value = gfc_build_addr_expr (NULL_TREE, tmp);
- }
-
gfc_init_se (&argse, NULL);
@@ -12721,11 +12714,2 @@ conv_intrinsic_atomic_ref (gfc_code *code)
gfc_add_block_to_block (&block, &argse.pre);
-
- /* Different type, need type conversion. */
- if (!POINTER_TYPE_P (TREE_TYPE (value)))
- {
- vardecl = gfc_create_var (TREE_TYPE (TREE_TYPE (atom)), "value");
- orig_value = value;
- value = gfc_build_addr_expr (NULL_TREE, vardecl);
- }
-
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_atomic_ref,
7,