Le 18/09/2022 à 12:48, Richard Biener a écrit :

Does *(&a[1]) count as a pointer dereference?

Yes, technically.

  Even in the original dump it is already simplified to a straight a[1].

But this not anymore.  The check can probably be relaxed, it stems from the 
dual purpose of CLOBBER.

So the following makes the frontend-emitted IL valid, by handing the simplification over to the middle-end, but I can't help thinking that behavior won't be more reliable.


diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index f8fcd2d97d9..5fb9a3a536d 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -6544,8 +6544,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                          && !sym->attr.elemental)
                        {
                          tree var;
-                         var = build_fold_indirect_ref_loc (input_location,
-                                                            parmse.expr);
+                         var = build1_loc (input_location, INDIRECT_REF,
+ TREE_TYPE (TREE_TYPE (parmse.expr)),
+                                           parmse.expr);
                          tree clobber = build_clobber (TREE_TYPE (var));
                          gfc_add_modify (&clobbers, var, clobber);
                        }

Reply via email to