[Bug fortran/105012] [12/13 Regression] wrf from SPECCPU2017 ICEs during LTO linking since r12-7692-g8db155ddf8cec9
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 25 21:19:41 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105012
--- Comment #28 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to anlauf from comment #23)
>
> No, they're not, when the procedures are in the same file.
> At least that's what gdb tells me...
gdb tells me the same. :-)
It is a side effect of calling gfc_check_externals it seems.
(In reply to anlauf from comment #27)
> (In reply to Mikael Morin from comment #26)
> >
> > Upon return from gfc_conv_expr, se->expr holds the value of the expression.
> > So basically var = se->expr;
> > As we manage to pass __result_derfc as argument, then I expect se->expr to
> > have value __result_derfc at that point.
>
> I tried that - just rechecked - and get an ICE: gimplification failed.
> So there's some magic missing I don't see...
With se->expr, what is generated is:
&__result_derfc = {CLOBBER};
Not too bad, but not exactly there yet.
With the following, I get the expected result.
Indeed, with se->want_pointer set, gfc_conv_expr generates an address
expression, so it has to be dereferenced to get back the variable.
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 6c8fa16e723..367ecc2eb65 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -9602,7 +9602,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr,
bool add_clobber)
tree var;
/* FIXME: This fails if var is passed by reference, see PR
41453. */
- var = expr->symtree->n.sym->backend_decl;
+ var = build_fold_indirect_ref_loc (input_location, se->expr);
clobber = build_clobber (TREE_TYPE (var));
gfc_add_modify (&se->pre, var, clobber);
}
More information about the Gcc-bugs
mailing list