This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 May 2014 12:28:50 +0000
- Subject: [Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
- Auto-submitted: auto-generated
- References: <bug-61138-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #2)
> gfc_trans_pointer_assignment sets lse.descriptor_only before calling
> gfc_conv_expr_descriptor (for the lhs), and later on reuses lse for other
> things, without clearing descriptor_only.
The proper fix would avoid reusing any gfc_se struct entirely;
a more humble, ad hoc fix could look like this:
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 5a50122..9748ade 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6684,2 +6684,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.expr = tmp;
+ lse.descriptor_only = 0;
lse.direct_byref = 1;
@@ -6699,2 +6700,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.direct_byref = 1;
+ lse.descriptor_only = 0;
gfc_conv_expr_descriptor (&lse, expr2);
@@ -6750,2 +6752,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.direct_byref = 1;
+ lse.descriptor_only = 0;
gfc_conv_expr_descriptor (&lse, expr2);