This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/50981] [4.4/4.5/4.6/4.7 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50981

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2011-11-03 16:39:10 UTC ---
No bootstraped compiler at hand; does this work?

diff --git a/trans-array.c b/trans-array.c
index 3472804..c48f718 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -2180,6 +2180,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss,
bool subscript,
       /* Scalar argument to elemental procedure.  Evaluate this
          now.  */
       gfc_init_se (&se, NULL);
+      se->want_pointer = 1;
       gfc_conv_expr (&se, ss->expr);
       gfc_add_block_to_block (&loop->pre, &se.pre);
       gfc_add_block_to_block (&loop->post, &se.post);
diff --git a/trans-expr.c b/trans-expr.c
index 09b98d0..9e9ceea 100644
--- a/trans-expr.c
+++ b/trans-expr.c
@@ -4823,8 +4823,6 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr)
       /* Substitute a scalar expression evaluated outside the scalarization
          loop.  */
       se->expr = se->ss->data.scalar.expr;
-      if (se->ss->type == GFC_SS_REFERENCE)
-    se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
       se->string_length = se->ss->string_length;
       gfc_advance_se_ss_chain (se);
       return;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]